Skip to content

fix: enable LeaderElectionReleaseOnCancel for rolling updates#64

Merged
Agalin merged 1 commit into
operasoftware:mainfrom
ermakov-oleg:fix/leader-election-release
May 20, 2026
Merged

fix: enable LeaderElectionReleaseOnCancel for rolling updates#64
Agalin merged 1 commit into
operasoftware:mainfrom
ermakov-oleg:fix/leader-election-release

Conversation

@ermakov-oleg

Copy link
Copy Markdown

Summary

Port of upstream #615

Enables LeaderElectionReleaseOnCancel: true in the controller manager options.

Problem: During rolling updates of the operator deployment, the old pod holds the leader election lease until it expires (default 15s). This means the new pod cannot start reconciliation until the lease times out, causing a gap in controller activity.

Fix: Setting LeaderElectionReleaseOnCancel: true makes the old leader release the lease immediately on context cancellation (graceful shutdown), so the new pod can acquire leadership instantly.

@ermakov-oleg ermakov-oleg force-pushed the fix/leader-election-release branch from 50b0bcb to 2160c8b Compare February 13, 2026 22:52
Port of upstream PR cloudnative-pg#615. Without this flag, RollingUpdate causes deadlock —
old pod holds leader lease preventing new pod from becoming ready.

Signed-off-by: ermakov-oleg <ermakovolegs@gmail.com>
@Agalin Agalin merged commit 716d295 into operasoftware:main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants