Skip to content

Commit 3a4a0c8

Browse files
committed
KCP: propagate timeouts to Machines with deletionTimestamp
Signed-off-by: Stefan Büringer [email protected]
1 parent 4758f18 commit 3a4a0c8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

controlplane/kubeadm/internal/controllers/controller.go

+15-1
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,22 @@ func (r *KubeadmControlPlaneReconciler) syncMachines(ctx context.Context, contro
610610
patchHelpers := map[string]*patch.Helper{}
611611
for machineName := range controlPlane.Machines {
612612
m := controlPlane.Machines[machineName]
613-
// If the machine is already being deleted, we don't need to update it.
613+
// If the machine is already being deleted, we only need to sync
614+
// the subset of fields that impact tearing down a machine
614615
if !m.DeletionTimestamp.IsZero() {
616+
patchHelper, err := patch.NewHelper(m, r.Client)
617+
if err != nil {
618+
return errors.Wrapf(err, "failed to generate patch for Machine %q", klog.KObj(m))
619+
}
620+
621+
// Set all other in-place mutable fields that impact the ability to tear down existing machines.
622+
m.Spec.NodeDrainTimeout = controlPlane.KCP.Spec.MachineTemplate.NodeDrainTimeout
623+
m.Spec.NodeDeletionTimeout = controlPlane.KCP.Spec.MachineTemplate.NodeDeletionTimeout
624+
m.Spec.NodeVolumeDetachTimeout = controlPlane.KCP.Spec.MachineTemplate.NodeVolumeDetachTimeout
625+
626+
if err := patchHelper.Patch(ctx, m); err != nil {
627+
return errors.Wrapf(err, "failed to update Machine %q", klog.KObj(m))
628+
}
615629
continue
616630
}
617631

0 commit comments

Comments
 (0)