Repository navigation
feat: support scaling clusters to 0 replicas - #410
GrigoryPervakov wants to merge 1 commit into
Conversation
|
Workflow [PR], commit [1ceb3b3] Summary: ✅ Code ReviewResult: ✅ No issues found What changed: Adds scale-to-zero support for ClickHouse and Keeper clusters while retaining persistent storage and Keeper membership metadata. It also removes managed PDBs at zero replicas, reports the stopped state as Ready with No issues found in the current implementation. Investigation: 8/13 rounds, 49 tool calls. |
AI review gate — AI review passedClean review from: Cursor Bugbot. |
7a3d8a7 to
3088d34
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3088d34. Configure here.
3088d34 to
1ceb3b3
Compare
There was a problem hiding this comment.
Auto-approved by the AI review gate on 1ceb3b3. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|

Why
In case the cluster is temporarily unneeded, it should be possible to stop it and later start it again.
What
Replicasfield when it is explicitly set to 0Note
Medium Risk
Touches core reconcile paths for cluster size, readiness, PDBs, Keeper quorum, and schema sync; mis-ordered stop/start or missing PVCs can affect data and coordination at runtime.
Overview
Adds
replicas: 0as a supported way to stopClickHouseClusterandKeeperClusterwithout deleting PVCs. The operator tears down per-replica workloads (StatefulSets, managed PDBs, etc.) while preserving volumes and (for scale-to-zero) Keeper replica registrations for a later resume.Reconciliation and status: When desired replica count is 0, PDBs are not created (or are removed); terminating pods are tracked via
IncludeTerminatingon replica resource lists.Readymoves throughScalingDownuntil the last pod is gone, thenScaledToZerowith a normalClusterReadyevent—intentionally stopped clusters are treated as ready, not not-ready. Keeper keeps the last quorum ConfigMap while scaled to zero and can scale to/from zero without the usual one-at-a-time quorum rules.ClickHouse-specific: Pre scale-down schema sync is skipped when scaling to zero;
NoKeeperNodesis emitted if ClickHouse still has replicas while the referenced Keeper has no nodes.ApplyDefaultno longer overwrites an explicitreplicas: 0(and similar non-struct pointer defaults).API comments, CRDs, charts, and user docs (scaling, events, PDB behavior) are updated accordingly, with controller and e2e tests for stop/start flows.
Reviewed by Cursor Bugbot for commit 1ceb3b3. Bugbot is set up for automated code reviews on this repo. Configure here.
Workflow [PR]