From 49681ff16a4d13be1787fa290d06e4691ebaa637 Mon Sep 17 00:00:00 2001 From: Alexandre Mahdhaoui Date: Sat, 23 Mar 2024 18:00:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20prevent=20leader=20election=20wh?= =?UTF-8?q?en=20shutting=20down=20a=20non-elected=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/manager/internal.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/manager/internal.go b/pkg/manager/internal.go index a16f354a1b..fdb9d982d9 100644 --- a/pkg/manager/internal.go +++ b/pkg/manager/internal.go @@ -518,6 +518,8 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e // Stop all the leader election runnables, which includes reconcilers. cm.logger.Info("Stopping and waiting for leader election runnables") + // Prevent leader election when shutting down a non-elected manager + cm.runnables.LeaderElection.startOnce.Do(func() {}) cm.runnables.LeaderElection.StopAndWait(cm.shutdownCtx) // Stop the caches before the leader election runnables, this is an important