Skip to content

Conversation

@guettli
Copy link
Collaborator

@guettli guettli commented Nov 17, 2025

Baremetal PR

Deprecated: This field is deprecated and is
going to be removed when support for v1beta1
will be dropped. Please see
https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md
for more details.

Related HCloud PR 1717

Here’s a shorter, clean PR description:


Summary

This PR removes all usage of the deprecated FailureReason and FailureMessage fields from the bare-metal (BM) provider. Status handling is now fully aligned with the newer CAPI conditions-based model.

Why

Upstream CAPI is deprecating these fields. Removing them keeps our provider consistent with the updated status API and prevents reliance on legacy status patterns.

Changes

  • BareMetalMachine.SetFailure() --> s.scope.SetErrorAndRemediate(). This sets the clusterv1.RemediateMachineAnnotation on the capiMachine.
  • During remediation the controller checks if the remediation was started by SetErrorAndRemediate(). If "yes", then no reboot gets done. The remediation stops, so that the machine gets deleted.
  • Removed all references to FailureReason and FailureMessage in BM controllers and API types.
  • Updated reconciliation logic to use standard Conditions exclusively.
  • Adjusted tests to match the new status behavior.
  • Test code was adapted to no longer use a fixed bmMachineName. Capi-machine and hbmm are exptected to have the same name. This was adapted, so test data structures match real structures.
  • The bm remediation does not take the Namespace from the InfrastructureRef. Cross namespace references are not allowed, because user1 of namespace1 must not reference namespace2.
  • Improved logging of unusual cases (conflictError, hbmm is deleting).
  • Duplicate code was removed and getAssociatedHost() was refactored to getAassociatedHostAndPatchHelper()
  • Remediation code expects that the capi-machine name and hbmm name are equal. Test code was adapted accordingly.

@github-actions github-actions bot added size/M Denotes a PR that changes 50-200 lines, ignoring generated files. area/code Changes made in the code directory area/api Changes made in the api directory labels Nov 17, 2025
@github-actions github-actions bot added size/L Denotes a PR that changes 200-800 lines, ignoring generated files. and removed size/M Denotes a PR that changes 50-200 lines, ignoring generated files. labels Nov 20, 2025
@guettli guettli requested a review from janiskemper November 26, 2025 15:07
Base automatically changed from tg/fix-hbmm-delete-test to main November 27, 2025 06:28
@guettli guettli changed the base branch from main to tg/pre--remove-failure-reason--baremetal--on-top-main November 27, 2025 12:31
@github-actions github-actions bot added size/L Denotes a PR that changes 200-800 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 800-2000 lines, ignoring generated files. labels Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api Changes made in the api directory area/code Changes made in the code directory area/github Changes made in the github directory area/hack Changes made in the hack directory size/L Denotes a PR that changes 200-800 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants