From 49f1096cba74008f84435dcbb82e59f43e5ae112 Mon Sep 17 00:00:00 2001 From: Armando Ruocco Date: Fri, 24 Oct 2025 14:00:24 +0200 Subject: [PATCH] fix: set LeaderElectionReleaseOnCancel to true to enable RollingUpdates (#615) Enable the LeaderElectionReleaseOnCancel option in the controller manager to fix a deadlock issue during RollingUpdate deployments with leader election enabled. Without this setting, the old pod holds the leader lease during shutdown, preventing the new pod from becoming ready. This creates a deadlock where Kubernetes won't terminate the old pod because the new pod isn't ready, and the new pod can't become ready because it can't acquire the lease. With LeaderElectionReleaseOnCancel enabled, the old pod voluntarily releases the lease when it receives a shutdown signal, allowing the new pod to acquire leadership immediately and become ready, enabling smooth rolling updates. Closes #419 Signed-off-by: Armando Ruocco --- internal/cnpgi/operator/manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cnpgi/operator/manager.go b/internal/cnpgi/operator/manager.go index 160eeab..94dfa72 100644 --- a/internal/cnpgi/operator/manager.go +++ b/internal/cnpgi/operator/manager.go @@ -119,7 +119,7 @@ func Start(ctx context.Context) error { // the manager stops, so would be fine to enable this option. However, // if you are doing or is intended to do any operation such as perform cleanups // after the manager stops then its usage might be unsafe. - // LeaderElectionReleaseOnCancel: true, + LeaderElectionReleaseOnCancel: true, }) if err != nil { setupLog.Error(err, "unable to start manager")