From 59f9c40b24d79dba3591d6f499903470d74d240a Mon Sep 17 00:00:00 2001 From: Mikhail Scherba Date: Wed, 29 May 2024 09:47:20 +0300 Subject: [PATCH] removing a terminating machine from balancing after some delay Signed-off-by: Mikhail Scherba --- pkg/controller/machine.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/controller/machine.go b/pkg/controller/machine.go index 048cb34e1..2267ec2b4 100644 --- a/pkg/controller/machine.go +++ b/pkg/controller/machine.go @@ -206,8 +206,6 @@ func (c *controller) reconcileClusterMachine(machine *v1alpha1.Machine) error { } if machine.DeletionTimestamp != nil { - c.setExcludeLBLabel(machine) - if c.safetyOptions.DrainDelay.Duration != 0 { if machine.DeletionTimestamp.Add(c.safetyOptions.DrainDelay.Duration).After(time.Now()) { klog.Infof("drain delay of %q has not yet passed for machine %q", c.safetyOptions.DrainDelay.Duration.String(), machine.Name) @@ -216,6 +214,9 @@ func (c *controller) reconcileClusterMachine(machine *v1alpha1.Machine) error { } } + // removing the machine from balancing + c.setExcludeLBLabel(machine) + // Processing of delete event if err := c.machineDelete(machine, driver); err != nil { c.enqueueMachineAfter(machine, MachineEnqueueRetryPeriod)