Skip to content

feat: support keeper on a different namespace#173

Merged
GrigoryPervakov merged 2 commits intoClickHouse:mainfrom
ertanden:main
Apr 30, 2026
Merged

feat: support keeper on a different namespace#173
GrigoryPervakov merged 2 commits intoClickHouse:mainfrom
ertanden:main

Conversation

@ertanden
Copy link
Copy Markdown
Contributor

@ertanden ertanden commented Apr 22, 2026

Why

ClickHouse clusters currently can only reference a Keeper cluster in the same namespace. This change is needed to allow deploying Keeper in a different namespace while keeping the existing same-namespace behavior working by default.

What

This change replaces keeperClusterRef with a small custom reference type that includes name and optional namespace. The ClickHouse controller now resolves Keeper by namespace and name, cross-namespace Keeper updates can requeue dependent ClickHouse clusters, and the CRD/docs/tests were updated to reflect the new reference format.

crd-breaking-change - suppress check, because keeperRef.name became required, which is not a breaking change as it was validated in the webhook before.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 22, 2026

CLA assistant check
All committers have signed the CLA.

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

Adds cross-namespace Keeper support by replacing keeperClusterRef with a custom reference type (name + optional namespace) and updating reconciliation + watches so Keeper changes can requeue dependent ClickHouse clusters across namespaces.

Changes:

  • Introduce KeeperClusterReference and resolution helpers, update controller to resolve Keeper by fully-qualified namespaced name.
  • Add a field index + watch mapping so Keeper updates enqueue referencing ClickHouse clusters (including cross-namespace references).
  • Update CRD/schema, docs, and tests to use/describe the new reference format and validate keeperClusterRef.namespace.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/e2e/clickhouse_e2e_test.go Updates e2e specs to use KeeperClusterReference.
test/deploy/deploy_test.go Updates deployment test manifests to use KeeperClusterReference.
internal/webhook/v1alpha1/clickhousecluster_webhook_test.go Adds webhook tests for valid/invalid keeper namespace.
internal/webhook/v1alpha1/clickhousecluster_webhook.go Validates keeperClusterRef.namespace as DNS1123 label when set.
internal/controller/clickhouse/sync.go Resolves Keeper using Cluster.KeeperClusterNamespacedName() and improves log/error context.
internal/controller/clickhouse/controller_test.go Adds tests for cross-namespace keeper watch mapping + reconciliation behavior.
internal/controller/clickhouse/controller.go Adds field indexer for keeper reference; watch mapping lists clusters via indexed field to support cross-namespace.
docs/introduction.md Documents default same-namespace behavior and optional keeperClusterRef.namespace.
docs/configuration.md Documents new keeperClusterRef.namespace and watch-namespace requirement.
docs/api_reference.md Updates API reference to document KeeperClusterReference.
dist/chart/templates/crd/clickhouseclusters.clickhouse.com.yaml Updates CRD schema for new keeper reference type.
config/crd/bases/clickhouse.com_clickhouseclusters.yaml Updates CRD base schema for new keeper reference type.
api/v1alpha1/zz_generated.deepcopy.go Regenerates deepcopy for the new reference type.
api/v1alpha1/types_test.go Adds unit tests for keeper namespaced name resolution defaulting.
api/v1alpha1/clickhousecluster_types.go Introduces KeeperClusterReference and resolution helpers on the API types.

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

Comment thread api/v1alpha1/clickhousecluster_types.go
@GrigoryPervakov GrigoryPervakov added the crd-breaking-change PR label to suppress crd-compatibility checks label Apr 28, 2026
@GrigoryPervakov GrigoryPervakov force-pushed the main branch 2 times, most recently from e226934 to 7469c6b Compare April 28, 2026 08:02
@GrigoryPervakov GrigoryPervakov merged commit 762d058 into ClickHouse:main Apr 30, 2026
17 checks passed
@ertanden
Copy link
Copy Markdown
Contributor Author

ertanden commented May 8, 2026

Thanks for merging. Is there a timeline for a new version release?

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

Labels

crd-breaking-change PR label to suppress crd-compatibility checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants