From 6988695fe410f0cb169404cebffa5e2c316c51c5 Mon Sep 17 00:00:00 2001 From: liuxu Date: Tue, 13 Aug 2024 18:31:14 +0800 Subject: [PATCH] skip drain node if DrainingSucceeded condition is already true --- internal/controllers/machine/machine_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/controllers/machine/machine_controller.go b/internal/controllers/machine/machine_controller.go index 31aa7726a868..211f99c5e49c 100644 --- a/internal/controllers/machine/machine_controller.go +++ b/internal/controllers/machine/machine_controller.go @@ -368,7 +368,7 @@ func (r *Reconciler) reconcileDelete(ctx context.Context, cluster *clusterv1.Clu conditions.MarkTrue(m, clusterv1.PreDrainDeleteHookSucceededCondition) // Drain node before deletion and issue a patch in order to make this operation visible to the users. - if r.isNodeDrainAllowed(m) { + if r.isNodeDrainAllowed(m) && !conditions.IsTrue(m, clusterv1.DrainingSucceededCondition) { patchHelper, err := patch.NewHelper(m, r.Client) if err != nil { return ctrl.Result{}, err