Skip to content

feat: Yield leadership of keeper pods before graceful shutdown - #351

Merged
GrigoryPervakov merged 4 commits into
ClickHouse:mainfrom
mu-soliman:yield-leadership
Sep 30, 2026
Merged

GrigoryPervakov merged 4 commits into
ClickHouse:mainfrom
mu-soliman:yield-leadership

Conversation

@mu-soliman

@mu-soliman mu-soliman commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Why

When the current keeper leader is restarted, a new leader is elected only after the old leader stops and timeout period passes. This creates a short period without a leader.

What

Add a default PreStop Lifecycle hook for keeper pods. The hook executes four letter word commandydld then keeps polling until the pod is not a leader.

The PreStop Lifecycle hook is overridable by defining it in the container template spec. This allows users to do something like setting an empty hook, which could be helpful for users who run distroless images that has no bash so they cannot run the default PreStop hook.

Related Issues

Fixes #346

@CLAassistant

CLAassistant commented Sep 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Add a default overridable Prestop lifecycle hook for keeper pods. The hook executes four letter word `yldl` then keeps polling until the pod is not a leader.
@mu-soliman mu-soliman changed the title Yield leadership of keeper pods before graceful shutdown Feat: Yield leadership of keeper pods before graceful shutdown Sep 29, 2026
@mu-soliman mu-soliman changed the title Feat: Yield leadership of keeper pods before graceful shutdown feat: Yield leadership of keeper pods before graceful shutdown Sep 29, 2026
@mu-soliman
mu-soliman marked this pull request as ready for review September 29, 2026 14:43
@GrigoryPervakov GrigoryPervakov self-assigned this Sep 29, 2026
Comment thread internal/controller/keeper/constants.go Outdated
Comment thread internal/controller/keeper/lifecycle.go
@mu-soliman mu-soliman added the feature Feature request label Sep 30, 2026
@GrigoryPervakov
GrigoryPervakov merged commit 09774ab into ClickHouse:main Sep 30, 2026
44 of 47 checks passed
@mintlify

mintlify Bot commented Sep 30, 2026

Copy link
Copy Markdown

Docs PR opened: ClickHouse/ClickHouse#123072

Added a Keeper preStop leadership handover section to the configuration guide and a lifecycle field to the API reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transfer Keeper leadership before restarting the leader during rolling updates

3 participants