diff --git a/charts/clickhouse/templates/_helpers.tpl b/charts/clickhouse/templates/_helpers.tpl index d3c8e7f..4fcac30 100644 --- a/charts/clickhouse/templates/_helpers.tpl +++ b/charts/clickhouse/templates/_helpers.tpl @@ -120,9 +120,15 @@ Pod Template Base {{- end }} resources: {{- toYaml .Values.clickhouse.resources | nindent 16 }} - {{- with .Values.clickhouse.extraContainers }} - {{- toYaml . | nindent 12 }} - {{- end }} + {{- if .Values.clickhouse.extraContainers}} + {{- with .Values.clickhouse.extraContainers }} + {{- $dataVol := printf "%s-%s-data" $.Release.Name $.Values.nameOverride }} + + {{- $y := toYaml . }} + {{- $y | replace "CLICKHOUSE_DATA_VOLUME" $dataVol | nindent 12 }} + + {{- end }} + {{- end }} {{- if or .Values.clickhouse.initScripts.enabled .Values.clickhouse.extraVolumes }} volumes: {{- if .Values.clickhouse.initScripts.enabled }} diff --git a/charts/clickhouse/templates/chi.yaml b/charts/clickhouse/templates/chi.yaml index 84b1a85..e64b732 100644 --- a/charts/clickhouse/templates/chi.yaml +++ b/charts/clickhouse/templates/chi.yaml @@ -154,8 +154,26 @@ spec: key: password {{- else if .password_sha256_hex }} {{ .name }}/password_sha256_hex: {{ .password_sha256_hex | quote }} + {{ .name }}/profile: {{ .name }} {{- end }} {{- end }} + {{- if .Values.clickhouse.users }} + profiles: + {{- range .Values.clickhouse.users }} + {{- if .profile }} + {{- $user := .name }} + {{- range $key, $value := .profile }} + {{ $user }}/{{ $key }}: "{{ $value }}" + {{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if .Values.clickhouse.settings }} + settings: + {{- range $key, $value := .Values.clickhouse.settings }} + {{ $key }}: "{{ $value }}" + {{- end }} + {{- end }} clusters: - name: {{ include "clickhouse.clustername" . }} {{- if .Values.clickhouse.clusterSecret.enabled }} diff --git a/charts/clickhouse/values.yaml b/charts/clickhouse/values.yaml index 737e61b..afdcfe7 100644 --- a/charts/clickhouse/values.yaml +++ b/charts/clickhouse/values.yaml @@ -26,7 +26,7 @@ clickhouse: # @default -- 127.0.0.1/32 hostIP: 127.0.0.1/32 - # -- Configure additional ClickHouse users. + # -- Configure additional ClickHouse users and their profiles. users: [] # users: # - name: app_user @@ -35,6 +35,26 @@ clickhouse: # password_secret_name: "app-user-secret" # secret must contain 'password' key # grants: # - "GRANT SELECT ON database.*" + # profile: + # max_memory_usage: "40000000000" + # max_query_size: "2000000" + # readonly: "0" + # allow_ddl: "0" + # connect_timeout_with_failover_ms: "10000" + # Server level settings for each clickhouse replica + settings: [] +# settings: +# max_table_size_to_drop: "0" +# max_concurrent_queries: 1000 +# logger/level: "error" +# logger/console: "true" +# restore_threads: 48 +# prometheus/endpoint: /metrics +# prometheus/port: 9363 +# prometheus/metrics: true +# prometheus/events: true +# prometheus/asynchronous_metrics: true +# prometheus/status_info: true # -- number of replicas. If greater than 1, keeper must be enabled # or a keeper host should be provided under clickhouse.keeper.host. @@ -179,6 +199,16 @@ clickhouse: # -- Extra containers for clickhouse pods extraContainers: [] +# If you want to make use of clickhouse data volume, which is the case of clickhouse-backup, you can specify the volumeMounts like this. +# The value will be automatically replaced. + + +# extraContainers: +# - name: clickhouse-backup +# image: altinity/clickhouse-backup:master +# volumeMounts: +# - name: CLICKHOUSE_DATA_VOLUME +# mountPath: /var/lib/clickhouse # -- Extra volumes for clickhouse pods extraVolumes: []