From 46e94e6fa1ac4bd66e64606b9a2e8fd2773c868c Mon Sep 17 00:00:00 2001 From: Artem Chernyshev Date: Wed, 15 May 2024 17:54:48 +0300 Subject: [PATCH] fix: do not block machine config updates if loadbalancer is down This check doesn't make sense for the config updates. We are trying to address the case when the config has broken the API server and you try to revert it. All api servers are down and you can not revert it because all api servers are down. Signed-off-by: Artem Chernyshev (cherry picked from commit a0d02ea20b2ebcc6556e80afe04cb22392afe561) --- .../machineset/control_planes_handler.go | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/internal/backend/runtime/omni/controllers/omni/internal/machineset/control_planes_handler.go b/internal/backend/runtime/omni/controllers/omni/internal/machineset/control_planes_handler.go index 5ebb488f..e56cc1d1 100644 --- a/internal/backend/runtime/omni/controllers/omni/internal/machineset/control_planes_handler.go +++ b/internal/backend/runtime/omni/controllers/omni/internal/machineset/control_planes_handler.go @@ -31,32 +31,30 @@ func ReconcileControlPlanes(ctx context.Context, rc *ReconciliationContext, etcd }), nil } - if !rc.LBHealthy() { - return nil, nil - } - // pending tearing down machines with finalizers should cancel any other operations if len(rc.GetTearingDownMachines()) > 0 { return nil, nil } - // do a single destroy - for _, id := range rc.GetMachinesToTeardown() { - clusterMachine, ok := rc.GetClusterMachine(id) - if !ok { - continue - } + if rc.LBHealthy() { + // do a single destroy + for _, id := range rc.GetMachinesToTeardown() { + clusterMachine, ok := rc.GetClusterMachine(id) + if !ok { + continue + } - etcdStatus, err := etcdStatusGetter(ctx) - if err != nil { - return nil, err - } + etcdStatus, err := etcdStatusGetter(ctx) + if err != nil { + return nil, err + } - if err := check.CanScaleDown(etcdStatus, clusterMachine); err != nil { - return nil, err - } + if err := check.CanScaleDown(etcdStatus, clusterMachine); err != nil { + return nil, err + } - return []Operation{&Teardown{ID: id}}, nil + return []Operation{&Teardown{ID: id}}, nil + } } // do a single update