Skip to content

Commit 49f1096

Browse files
authored
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 <[email protected]>
1 parent 782fe77 commit 49f1096

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/cnpgi/operator/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func Start(ctx context.Context) error {
119119
// the manager stops, so would be fine to enable this option. However,
120120
// if you are doing or is intended to do any operation such as perform cleanups
121121
// after the manager stops then its usage might be unsafe.
122-
// LeaderElectionReleaseOnCancel: true,
122+
LeaderElectionReleaseOnCancel: true,
123123
})
124124
if err != nil {
125125
setupLog.Error(err, "unable to start manager")

0 commit comments

Comments
 (0)