feat(api): support externally managed Keeper clusters - #292
Open
melancholictheory wants to merge 1 commit into
Open
feat(api): support externally managed Keeper clusters#292melancholictheory wants to merge 1 commit into
melancholictheory wants to merge 1 commit into
Conversation
Add spec.externalKeeper so a ClickHouseCluster can use a Keeper ensemble this operator does not manage, and make spec.keeperClusterRef optional. The validating webhook requires exactly one of the two. With externalKeeper set the operator builds the zookeeper config section from the listed nodes, skips reading the KeeperCluster object and its readiness check, and skips the pod affinity that co-locates ClickHouse with Keeper pods. Keeper authentication is unchanged and still comes from the keeper-identity key of the cluster Secret. TLS is an ensemble-level enum rather than a per-node boolean because crd-schema-checker rejects newly added boolean fields. keeperClusterRef became a pointer so that omitting it does not serialize as an empty object, which the CRD rejects. Fixes ClickHouse#285
melancholictheory
force-pushed
the
feat/external-keeper
branch
from
August 16, 2026 12:59
e174a97 to
9d342d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ClickHouseClusterSpecrequireskeeperClusterRef, which ties a ClickHouse cluster to aKeeperClusterthis operator owns. Plenty of people already run Keeper somewhere else: managed by a different operator, in another Kubernetes cluster, on VMs or bare metal, or shared between several systems. Until now there was no way to point ClickHouse at one of those.What
Adds
spec.externalKeeperand makesspec.keeperClusterRefoptional. The validating webhook requires exactly one of the two, so existing clusters behave exactly as before and neither field can be silently omitted.portdefaults to9181. TLS is an ensemble-leveltls: Enabled|Disabledenum rather than a per-node boolean, becausecrd-schema-checkerrejects newly added boolean fields under itsNoBoolsrule. It also matches how the operator already treats its own Keeper, where TLS is uniform across the ensemble.When
externalKeeperis set, the operator:zookeeperconfig section from the listed nodes,KeeperClusterobject and its readiness check, since it does not own that lifecycle,Keeper authentication is unchanged. The identity still comes from the
keeper-identitykey of the cluster Secret, so an external ensemble works through the existing mechanism.keeperClusterRefbecame a pointer. As a value struct it would serialize tokeeperClusterRef: {}when unset, which the CRD rejects becausenameis required inside it.KeeperClusterReference.NamespacedNamealready had a nil check, so the call sites did not need changing.Dropping
keeperClusterReffrom the CRDrequiredlist only relaxes the schema;make check-crd-compatpasses againstmain.Docs get a new "Externally managed Keeper" section in the configuration guide.
Testing
Unit tests cover all four combinations of the two fields in the validating webhook, the CRD defaults, and config generation for both plain and TLS ensembles.
I also ran it on a live k3d cluster:
externalKeeperreaches Ready,zookeeper.nodesrenders the given hosts, andpodAffinityis absent from the StatefulSet,keeperClusterRefstill reaches Ready and still gets the KeeperpodAffinity,Related Issues
Fixes #285