Skip to content

Commit 0e653c5

Browse files
authored
PCP-5472: During HCP cluster upgrade , one of the machine is stuck in deleting state (#279)
* PCP-5472: During HCP cluster upgrade , one of the machine is stuck in deleting state
1 parent 96c6a4a commit 0e653c5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

controllers/maasmachine_controller.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,17 @@ func (r *MaasMachineReconciler) reconcileDelete(_ context.Context, machineScope
176176

177177
// Check if the host evacuation finalizer is present - if so, requeue for HMC controller
178178
if controllerutil.ContainsFinalizer(maasMachine, HostEvacuationFinalizer) {
179+
// Evacuation requires the MAAS systemID; if it's missing, there's nothing to evacuate.
180+
hasSystemID := maasMachine.Spec.SystemID != nil && *maasMachine.Spec.SystemID != ""
181+
if !hasSystemID {
182+
machineScope.Info("No systemID/providerID; removing evacuation finalizer to unblock deletion")
183+
controllerutil.RemoveFinalizer(maasMachine, HostEvacuationFinalizer)
184+
return ctrl.Result{}, nil
185+
}
186+
187+
// Log using Spec.SystemID directly to avoid providerID parse errors
179188
machineScope.Info("Host evacuation finalizer present, requeuing for HMC controller to handle evacuation",
180-
"systemID", machineScope.GetInstanceID())
189+
"systemID", *maasMachine.Spec.SystemID)
181190
return ctrl.Result{RequeueAfter: 10 * time.Second}, nil
182191
}
183192

0 commit comments

Comments
 (0)