Skip to content

Don't restart pods on some config changes#115

Merged
GrigoryPervakov merged 2 commits into
mainfrom
reload_without_restart
May 22, 2026
Merged

Don't restart pods on some config changes#115
GrigoryPervakov merged 2 commits into
mainfrom
reload_without_restart

Conversation

@scanhex12
Copy link
Copy Markdown
Member

@scanhex12 scanhex12 commented Mar 4, 2026

Why

Some configuration updates don't require a pod restart. This pull request improves that behavior.

What

Annotate generated config files with RequiresRestart and split the config revision into reloadable and restartable parts.
Track config runtime reload with a reserved named collection key.

Related Issues

Related to #15

@scanhex12 scanhex12 marked this pull request as draft March 4, 2026 20:25
@scanhex12 scanhex12 requested a review from Copilot March 17, 2026 17:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent unnecessary ClickHouse pod restarts for configuration changes that ClickHouse can reload dynamically (e.g., ExtraUsersConfig), while still restarting pods for config changes that require it.

Changes:

  • Add a “restart-required config hash” annotation to StatefulSets and use it to decide whether a ConfigMap change should trigger a pod restart.
  • If restart is not required, issue ClickHouse SYSTEM RELOAD CONFIG / SYSTEM RELOAD USERS commands instead of restarting pods.
  • Add an e2e test asserting that ExtraUsersConfig updates do not restart pods.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/e2e/clickhouse_e2e_test.go Adds an e2e scenario validating no pod restart on ExtraUsersConfig changes.
internal/controllerutil/annotations.go Introduces an annotation key + helpers for storing/retrieving the restart-required config hash.
internal/controller/clickhouse/templates.go Defines which generated config keys are considered restart-required and computes a hash for them.
internal/controller/clickhouse/sync.go Updates reconcile logic to restart only when restart-required config changes; otherwise reload in-place.
internal/controller/clickhouse/commands.go Adds commander methods to run ClickHouse SYSTEM RELOAD CONFIG/USERS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread internal/controller/clickhouse/sync.go Outdated
Comment thread internal/controller/clickhouse/sync.go Outdated
Comment thread test/e2e/clickhouse_e2e_test.go Outdated
@scanhex12 scanhex12 force-pushed the reload_without_restart branch from fb801c8 to 6e25096 Compare March 19, 2026 12:41
@GrigoryPervakov GrigoryPervakov force-pushed the reload_without_restart branch 2 times, most recently from 212f395 to fd1de86 Compare May 20, 2026 19:43
@GrigoryPervakov GrigoryPervakov requested a review from Copilot May 21, 2026 10:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread internal/controller/clickhouse/config.go Outdated
Comment thread internal/controller/clickhouse/commands.go Outdated
Comment thread internal/controller/resourcemanager.go Outdated
Comment thread internal/controller/clickhouse/sync.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Comment thread internal/controller/clickhouse/templates.go Outdated
Comment thread internal/controller/resourcemanager.go Outdated
Comment thread internal/controller/keeper/sync.go
Comment thread internal/controller/resourcemanager.go
@GrigoryPervakov GrigoryPervakov force-pushed the reload_without_restart branch from 502b024 to 91784d8 Compare May 22, 2026 15:02
@GrigoryPervakov GrigoryPervakov marked this pull request as ready for review May 22, 2026 15:43
@GrigoryPervakov GrigoryPervakov merged commit 963ff9a into main May 22, 2026
18 checks passed
@GrigoryPervakov GrigoryPervakov deleted the reload_without_restart branch May 22, 2026 15:44
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.

3 participants