Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions deploy/helm/clickhouse-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,25 @@ null
{{- tpl (toYaml (dict $k $v)) $root }}
{{ end }}
{{- end }}

{{/*
altinity-clickhouse-operator.configmap-files merges watchNamespaces into the
operator config before rendering the ConfigMap data block.

This exists because configs.files.config.yaml.watch.namespaces.include is
deep inside a nested structure — Helm's values merge cannot target it
directly. Instead we deepCopy the files map, patch the nested value in-place,
and pass the result to configmap-data.

Arguments (list): root context, configs.files, watchNamespaces list
*/}}
{{- define "altinity-clickhouse-operator.configmap-files" -}}
{{- $root := index . 0 -}}
{{- $files := deepCopy (index . 1) -}}
{{- $watchNamespaces := index . 2 -}}
{{- if $watchNamespaces -}}
{{- $namespaces := index (index (index $files "config.yaml") "watch") "namespaces" -}}
{{- $_ := set $namespaces "include" $watchNamespaces -}}
{{- end -}}
{{- include "altinity-clickhouse-operator.configmap-data" (list $root $files) -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ metadata:
namespace: {{ include "altinity-clickhouse-operator.namespace" . }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 4 }}
annotations: {{ include "altinity-clickhouse-operator.annotations" . | nindent 4 }}
data: {{ include "altinity-clickhouse-operator.configmap-data" (list . .Values.configs.files) | nindent 2 }}
data: {{ include "altinity-clickhouse-operator.configmap-files" (list . .Values.configs.files .Values.watchNamespaces) | nindent 2 }}
5 changes: 5 additions & 0 deletions deploy/helm/clickhouse-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ podAnnotations:
prometheus.io/scrape: 'true'
clickhouse-operator-metrics/port: '9999'
clickhouse-operator-metrics/scrape: 'true'
# 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.
# Example: watchNamespaces: ["clickhouse", "my-other-namespace"]
watchNamespaces: []
# nameOverride -- override name of the chart
nameOverride: ""
# fullnameOverride -- full name of the chart.
Expand Down