Repository navigation
feat: support multi-cluster Keeper and ClickHouse deployments - #412
melancholictheory wants to merge 4 commits into
Conversation
Add replicaIDOffset and externalPeers to KeeperCluster, and shardIDOffset, replicaIDOffset, and externalReplicas to ClickHouseCluster so a single logical Keeper ensemble and ClickHouse cluster can span multiple Kubernetes clusters or regions. Fixes ClickHouse#144
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 3048c43. Configure here.
AI review gate — AI review passedClean review from: Cursor Bugbot. |
|
Thank you for your contribution. It's a cool feature. I would try to review it, but it may take longer. |
|
Workflow [PR], commit [eca7e32] Summary: ❌
Code ReviewResult: ❌ Blocking issues What changed: Adds multi-cluster Keeper and ClickHouse support through local ID offsets, externally managed Keeper peers and ClickHouse replicas, merged runtime configuration, cross-cluster schema discovery, and metadata-preserving cleanup. It also updates validation, generated CRDs/charts, documentation, and tests for these deployment modes. Blocking
Other issue
Investigation: 8/13 rounds, 49 tool calls. |

Why
Running a single ClickHouse or Keeper cluster across multiple Kubernetes clusters or regions was not possible because each operator assumed local shard/replica IDs starting at
0, odd local Keeper replica counts, and sole ownership of all replicas inraft_configuration,remote_servers, and Keeper metadata cleanup.What
KeeperCluster(v1alpha1): addedspec.replicaIDOffset(immutable) andspec.externalPeers; relaxed localreplicasto allow even counts whenexternalPeersis set; updated Raft quorum generation,loadQuorumReplicas, readiness/scaling checks (supporting remote Raft leaders), andClickHouseClusterKeeper peer discovery viakeeperClusterRef.ClickHouseCluster(v1alpha1): addedspec.shardIDOffset,spec.replicaIDOffset(both immutable), andspec.externalReplicas; merged local and external replicas intoremote_servers.default; updated schema sync, stale replica metadata cleanup (preserving external replicas), and shard-peer recovery fallback.Related Issues
Fixes #144
Note
High Risk
Changes core CRD shape, Raft quorum,
remote_servers, and Keeper metadata cleanup—misconfiguration or bugs could break cross-cluster replication or quorum.Overview
Adds multi-cluster / multi-region support so one logical ClickHouse cluster and Keeper Raft ensemble can span several Kubernetes clusters, each running its own operator instance.
ClickHouseClustergains immutableshardIDOffsetandreplicaIDOffset, plusexternalReplicas(host, port, optional TLS). Local shard/replica iteration and obsolescence checks use those offsets. Generated config merges local and external replicas intoremote_servers.default; Keeper client config can includeKeeperClusterexternalPeers. Schema sync can discover databases viaclusterAllReplicas; stale-replica cleanup skips external replicas and uses offset-aware bounds, with optional TLS to external peers for shard-peer operations.KeeperClustergains immutablereplicaIDOffsetandexternalPeers(Raft + optionalclientPort). Local replica IDs and quorumraft_configurationinclude external members; readiness and horizontal scaling use total ensemble size (local + external), including when the Raft leader is remote. The odd-local-replica rule is relaxed whenexternalPeersis set, within a 15-node ensemble cap.CRD CEL rules, validating webhooks, Helm values, API reference, and a configuration guide section document and enforce non-colliding IDs and immutability.
Reviewed by Cursor Bugbot for commit deac6d8. Bugbot is set up for automated code reviews on this repo. Configure here.
Workflow [PR]