base branch v1.1.x
Summary
Add v1beta2 conditions to HetznerBareMetalMachine while keeping the existing v1beta1 conditions unchanged.
What would you like to add
HetznerBareMetalMachine is an infrastructure machine object that manages the lifecycle of a Hetzner bare metal server by associating with a HetznerBareMetalHost and tracking its provisioning state.
Today the machine lifecycle is surfaced through v1beta1 conditions:
| Condition |
Purpose |
HCloudTokenAvailable |
Hetzner API credentials are valid and reachable |
BootstrapReady |
Bootstrap data has been provided by CAPI |
HostAssociateSucceeded |
Machine has been associated with a HetznerBareMetalHost |
HostReady |
Mirrors the associated host's Ready condition |
These conditions are still needed and must keep their current behavior. At the same time, the CAPI v1beta2 transition requires HetznerBareMetalMachine to expose v1beta2 conditions in parallel.
The condition-setting code lives in two places:
- Controller (
controllers/hetznerbaremetalmachine_controller.go): Sets HCloudTokenAvailable in a defer block on ErrUnauthorized, and via the shared hcloudTokenErrorResult helper for secret-not-found and token-validation errors.
- Baremetal service (
pkg/services/baremetal/baremetal/baremetal.go): Sets BootstrapReady, HostAssociateSucceeded, and HostReady during the Reconcile flow. HostReady is mirrored from the associated host's ReadyCondition.
Deletion also needs to be visible more clearly. Today the machine sets Status.Phase = MachinePhaseDeleting but does not set a dedicated condition. We want a v1beta2 Deleting condition for HetznerBareMetalMachine, since this resource has a finalizer and a delete reconciliation path.
The Solution
Follow the same structure used for HCloudMachine:
- Add
status.v1beta2.conditions to HetznerBareMetalMachine.
- Keep writing the existing v1beta1 conditions exactly as today.
- Add direct
v1beta2conditions.Set(...) calls in the same controller and service code paths that already set the v1beta1 conditions.
- Add a controller local patch step for
HetznerBareMetalMachine that computes:
- the legacy v1beta1 summary
- the v1beta2
Ready summary
- the owned v1beta2 condition set for patching
- Add a dedicated v1beta2
Deleting condition.
Final Conditions
The final v1beta2 conditions added for HetznerBareMetalMachine are:
| Constant |
Type |
Polarity |
Notes |
HetznerBareMetalMachineReadyV1Beta2Condition |
clusterv1.ReadyV1Beta2Condition |
Positive |
Summary condition |
HetznerBareMetalMachineHCloudTokenAvailableV1Beta2Condition |
HCloudTokenAvailable |
Positive |
True when HCloud credentials are valid and reachable |
HetznerBareMetalMachineBootstrapReadyV1Beta2Condition |
BootstrapReady |
Positive |
True when bootstrap data is available |
HetznerBareMetalMachineHostAssociateSucceededV1Beta2Condition |
HostAssociateSucceeded |
Positive |
True when a host has been associated |
HetznerBareMetalMachineHostReadyV1Beta2Condition |
HostReady |
Positive |
Mirrors associated host's Ready condition |
HetznerBareMetalMachineDeletingV1Beta2Condition |
clusterv1.DeletingV1Beta2Condition |
Negative |
Dedicated deletion signal |
base branch v1.1.x
Summary
Add v1beta2 conditions to
HetznerBareMetalMachinewhile keeping the existing v1beta1 conditions unchanged.What would you like to add
HetznerBareMetalMachineis an infrastructure machine object that manages the lifecycle of a Hetzner bare metal server by associating with aHetznerBareMetalHostand tracking its provisioning state.Today the machine lifecycle is surfaced through v1beta1 conditions:
HCloudTokenAvailableBootstrapReadyHostAssociateSucceededHetznerBareMetalHostHostReadyReadyconditionThese conditions are still needed and must keep their current behavior. At the same time, the CAPI v1beta2 transition requires
HetznerBareMetalMachineto expose v1beta2 conditions in parallel.The condition-setting code lives in two places:
controllers/hetznerbaremetalmachine_controller.go): SetsHCloudTokenAvailablein a defer block onErrUnauthorized, and via the sharedhcloudTokenErrorResulthelper for secret-not-found and token-validation errors.pkg/services/baremetal/baremetal/baremetal.go): SetsBootstrapReady,HostAssociateSucceeded, andHostReadyduring theReconcileflow.HostReadyis mirrored from the associated host'sReadyCondition.Deletion also needs to be visible more clearly. Today the machine sets
Status.Phase = MachinePhaseDeletingbut does not set a dedicated condition. We want a v1beta2Deletingcondition forHetznerBareMetalMachine, since this resource has a finalizer and a delete reconciliation path.The Solution
Follow the same structure used for
HCloudMachine:status.v1beta2.conditionstoHetznerBareMetalMachine.v1beta2conditions.Set(...)calls in the same controller and service code paths that already set the v1beta1 conditions.HetznerBareMetalMachinethat computes:ReadysummaryDeletingcondition.Final Conditions
The final v1beta2 conditions added for
HetznerBareMetalMachineare:HetznerBareMetalMachineReadyV1Beta2Conditionclusterv1.ReadyV1Beta2ConditionHetznerBareMetalMachineHCloudTokenAvailableV1Beta2ConditionHCloudTokenAvailableHetznerBareMetalMachineBootstrapReadyV1Beta2ConditionBootstrapReadyHetznerBareMetalMachineHostAssociateSucceededV1Beta2ConditionHostAssociateSucceededHetznerBareMetalMachineHostReadyV1Beta2ConditionHostReadyHetznerBareMetalMachineDeletingV1Beta2Conditionclusterv1.DeletingV1Beta2Condition