Skip to content

Commit 9dfb847

Browse files
committed
Propagate values inplace during machine deletion that pertain to machine deletion
Signed-off-by: David Vossel <[email protected]>
1 parent e7c3d5f commit 9dfb847

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

internal/controllers/machineset/machineset_controller.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,21 @@ func (r *Reconciler) syncMachines(ctx context.Context, machineSet *clusterv1.Mac
362362
log := ctrl.LoggerFrom(ctx)
363363
for i := range machines {
364364
m := machines[i]
365-
// If the machine is already being deleted, we don't need to update it.
365+
// If the machine is already being deleted, we only need to sync
366+
// the subset of fields that impact tearing down a machine
366367
if !m.DeletionTimestamp.IsZero() {
368+
patch := client.MergeFrom(m.DeepCopy())
369+
370+
// Set all other in-place mutable fields that impact the ability to tear down existing machines.
371+
m.Spec.NodeDrainTimeout = machineSet.Spec.Template.Spec.NodeDrainTimeout
372+
m.Spec.NodeDeletionTimeout = machineSet.Spec.Template.Spec.NodeDeletionTimeout
373+
m.Spec.NodeVolumeDetachTimeout = machineSet.Spec.Template.Spec.NodeVolumeDetachTimeout
374+
375+
err := r.Client.Patch(ctx, m, patch)
376+
if err != nil {
377+
log.Error(err, "failed to update Machine", "Machine", klog.KObj(m))
378+
return errors.Wrapf(err, "failed to update Machine %q", klog.KObj(m))
379+
}
367380
continue
368381
}
369382

0 commit comments

Comments
 (0)