clickhouse-operator
clickhouse-operator copied to clipboard
fix(helm): wire watchNamespaces value into operator ConfigMap
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:
- A top-level
watchNamespacesvalue invalues.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: []
-
A new
altinity-clickhouse-operator.configmap-fileshelper in_helpers.tplthat deep-copiesconfigs.files, patcheswatch.namespaces.includein-place, and delegates to the existingconfigmap-datahelper for rendering. -
The ConfigMap template updated to call the new helper instead of
configmap-datadirectly.
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 namespacewatchNamespaces: [".*"]— 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:'