From 3272f5b9fd68d2effcf90b5209aa57d97702ebde Mon Sep 17 00:00:00 2001 From: rjshrjndrn Date: Fri, 11 Apr 2025 17:19:40 +0200 Subject: [PATCH] refactor(clickhouse): split server and user config Split the ClickHouse configuration into separate ConfigMaps for server and user configurations. This allows more granular management of the different configuration types and proper mounting to their respective paths. - Created separate serverConfig and userConfig under configOverride - Added user-default.xml under userConfig - Updated StatefulSet to mount each ConfigMap separately Signed-off-by: rjshrjndrn --- .../clickhouse/templates/configmap.yaml | 16 ++++-- .../clickhouse/templates/statefulset.yaml | 12 +++-- .../databases/charts/clickhouse/values.yaml | 49 ++++++++++--------- 3 files changed, 48 insertions(+), 29 deletions(-) diff --git a/scripts/helmcharts/databases/charts/clickhouse/templates/configmap.yaml b/scripts/helmcharts/databases/charts/clickhouse/templates/configmap.yaml index 41a94dd90..709e0929e 100644 --- a/scripts/helmcharts/databases/charts/clickhouse/templates/configmap.yaml +++ b/scripts/helmcharts/databases/charts/clickhouse/templates/configmap.yaml @@ -1,10 +1,20 @@ +--- apiVersion: v1 kind: ConfigMap metadata: - name: clickhouse-override + name: clickhouse-server-override data: - {{- range $filename, $content := .Values.configOverride }} + {{- range $filename, $content := .Values.configOverride.serverConfig }} + {{ $filename }}: |- +{{ $content | indent 4 }} + {{- end }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: clickhouse-user-override +data: + {{- range $filename, $content := .Values.configOverride.userConfig }} {{ $filename }}: |- {{ $content | indent 4 }} {{- end }} - diff --git a/scripts/helmcharts/databases/charts/clickhouse/templates/statefulset.yaml b/scripts/helmcharts/databases/charts/clickhouse/templates/statefulset.yaml index dedcbb428..110f2a9a4 100644 --- a/scripts/helmcharts/databases/charts/clickhouse/templates/statefulset.yaml +++ b/scripts/helmcharts/databases/charts/clickhouse/templates/statefulset.yaml @@ -73,7 +73,9 @@ spec: volumeMounts: - name: default-chi-openreplay-clickhouse-replicated-0-0-0 mountPath: /var/lib/clickhouse - - name: clickhouse-override-config + - name: clickhouse-override-server-config + mountPath: /etc/clickhouse-server/config.d + - name: clickhouse-override-user-config mountPath: /etc/clickhouse-server/config.d resources: {{- toYaml .Values.resources | nindent 12 }} @@ -90,9 +92,13 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - - name: clickhouse-override-config + - name: clickhouse-override-server-config configMap: - name: clickhouse-override + name: clickhouse-server-override + optional: true + - name: clickhouse-override-user-config + configMap: + name: clickhouse-user-override optional: true volumeClaimTemplates: - metadata: diff --git a/scripts/helmcharts/databases/charts/clickhouse/values.yaml b/scripts/helmcharts/databases/charts/clickhouse/values.yaml index b5cf37f44..1930307a7 100644 --- a/scripts/helmcharts/databases/charts/clickhouse/values.yaml +++ b/scripts/helmcharts/databases/charts/clickhouse/values.yaml @@ -85,26 +85,29 @@ affinity: {} storageSize: 100Gi configOverride: - zzoverride.xml: |- - - - information - true - - - - 0.0.0.0 - 100 - 64 - 2 - fair_round_robin - 102400000000 - 10000 - 0.8 - - 26214 - - # another-config.xml: |- - # - # value - # + serverConfig: + zzoverride.xml: |- + # + # + # information + # true + # + # + # + # 0.0.0.0 + # 100 + # 64 + # 2 + # fair_round_robin + # 102400000000 + # 10000 + # 0.8 + # + # 26214 + # + # another-config.xml: |- + # + # value + # + userConfig: + user-default.xml: |-