Skip to content

Commit ea85282

Browse files
committed
fix(hosting): include the default ClickHouse data-paths config in the restart checksum
The data-paths.xml default now lives in a shared helper used by both the ConfigMap and the pod checksum annotation, so changing it in a future chart version restarts the pod (subPath mounts do not update in place).
1 parent c53b098 commit ea85282

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

hosting/k8s/helm/templates/_helpers.tpl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,28 @@ rewritten to `%20`.
418418
{{- . | urlquery | replace "+" "%20" -}}
419419
{{- end }}
420420

421+
{{/*
422+
ClickHouse data-paths config. Keeps the on-disk layout compatible with data
423+
volumes created by the Bitnami subchart this chart used previously, which
424+
stored everything under a data/ subdirectory of the volume. Fresh installs
425+
get the same layout. tmp lives outside data/ because old volumes contain a
426+
dangling tmp symlink there. Users can override by defining their own
427+
data-paths.xml in clickhouse.configdFiles.
428+
*/}}
429+
{{- define "trigger-v4.clickhouse.dataPathsConfig" -}}
430+
<clickhouse>
431+
<path>/var/lib/clickhouse/data/</path>
432+
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
433+
<user_files_path>/var/lib/clickhouse/data/user_files/</user_files_path>
434+
<format_schema_path>/var/lib/clickhouse/data/format_schemas/</format_schema_path>
435+
<user_directories>
436+
<local_directory>
437+
<path>/var/lib/clickhouse/data/access/</path>
438+
</local_directory>
439+
</user_directories>
440+
</clickhouse>
441+
{{- end }}
442+
421443
{{/*
422444
ClickHouse hostname
423445
*/}}

hosting/k8s/helm/templates/clickhouse.yaml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,8 @@ metadata:
88
{{- include "trigger-v4.componentLabels" (dict "Chart" .Chart "Release" .Release "Values" .Values "component" $component) | nindent 4 }}
99
data:
1010
{{- if not (hasKey .Values.clickhouse.configdFiles "data-paths.xml") }}
11-
{{- /* Keeps the on-disk layout compatible with data volumes created by the
12-
Bitnami subchart this chart used previously, which stored everything
13-
under a data/ subdirectory of the volume. Fresh installs get the same
14-
layout. tmp lives outside data/ because old volumes contain a
15-
dangling tmp symlink there. */}}
1611
data-paths.xml: |
17-
<clickhouse>
18-
<path>/var/lib/clickhouse/data/</path>
19-
<tmp_path>/var/lib/clickhouse/tmp/</tmp_path>
20-
<user_files_path>/var/lib/clickhouse/data/user_files/</user_files_path>
21-
<format_schema_path>/var/lib/clickhouse/data/format_schemas/</format_schema_path>
22-
<user_directories>
23-
<local_directory>
24-
<path>/var/lib/clickhouse/data/access/</path>
25-
</local_directory>
26-
</user_directories>
27-
</clickhouse>
12+
{{- include "trigger-v4.clickhouse.dataPathsConfig" . | nindent 4 }}
2813
{{- end }}
2914
{{- range $filename, $content := .Values.clickhouse.configdFiles }}
3015
{{ $filename }}: |
@@ -73,7 +58,7 @@ spec:
7358
template:
7459
metadata:
7560
annotations:
76-
checksum/config: {{ .Values.clickhouse.configdFiles | toYaml | sha256sum }}
61+
checksum/config: {{ printf "%s\n%s" (include "trigger-v4.clickhouse.dataPathsConfig" .) (.Values.clickhouse.configdFiles | toYaml) | sha256sum }}
7762
checksum/secret: {{ .Values.clickhouse.auth.password | sha256sum }}
7863
{{- with .Values.clickhouse.podAnnotations }}
7964
{{- toYaml . | nindent 8 }}

0 commit comments

Comments
 (0)