Skip to content

fix(helm): wire watchNamespaces value into operator ConfigMap#2007

Open
jtomaszon wants to merge 1 commit into
Altinity:masterfrom
scaledb-io:fix/helm-watch-namespaces-1919
Open

fix(helm): wire watchNamespaces value into operator ConfigMap#2007
jtomaszon wants to merge 1 commit into
Altinity:masterfrom
scaledb-io:fix/helm-watch-namespaces-1919

Conversation

@jtomaszon

Copy link
Copy Markdown

Problem

Closes #1919.

configs.files.config.yaml.watch.namespaces.include is hardcoded to [] in values.yaml and the ConfigMap template renders it directly — there is no way to override it via a top-level Helm value. Users who need the operator to watch multiple namespaces must manually patch the ConfigMap after install, which is fragile and breaks on upgrades.

Solution

This PR introduces:

  1. A top-level watchNamespaces value in values.yaml (empty by default — preserves existing behavior):
# watchNamespaces -- namespaces where the operator watches for ClickHouseInstallation resources.
# If empty, the operator watches only its own namespace (or all namespaces when running in kube-system).
# Use [".*"] to watch all namespaces.
watchNamespaces: []
  1. A new altinity-clickhouse-operator.configmap-files helper in _helpers.tpl that deep-copies configs.files, patches watch.namespaces.include in-place, and delegates to the existing configmap-data helper for rendering.

  2. The ConfigMap template updated to call the new helper instead of configmap-data directly.

Usage

# values.yaml
watchNamespaces:
  - clickhouse-system
  - my-app-namespace

Or via --set:

helm install clickhouse-operator altinity/altinity-clickhouse-operator \
  --set "watchNamespaces={clickhouse-system,my-app-namespace}"

Behavior

  • watchNamespaces: [] (default) — no change, operator watches its own namespace
  • watchNamespaces: [".*"] — watch all namespaces
  • Any non-empty list — operator watches exactly those namespaces

Testing

# Default — include stays []
helm template test deploy/helm/clickhouse-operator \
  --show-only templates/generated/ConfigMap-etc-clickhouse-operator-files.yaml | grep -A5 'watch:'

# With namespaces set
helm template test deploy/helm/clickhouse-operator \
  --set 'watchNamespaces={clickhouse-system,everest-dev}' \
  --show-only templates/generated/ConfigMap-etc-clickhouse-operator-files.yaml | grep -A8 'watch:'

The configs.files.config.yaml.watch.namespaces.include field was
hardcoded to [] in values.yaml and the ConfigMap template rendered it
directly with no way to override it via a top-level Helm value.

This patch introduces a top-level watchNamespaces value and a new
configmap-files helper that deep-copies configs.files, patches the
nested watch.namespaces.include in-place, then delegates to the
existing configmap-data helper for rendering.

Fixes Altinity#1919
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.

Helm chart v0.25.6: configs.watch.namespaces value is ignored — ConfigMap always renders watch.namespaces: []

1 participant