openreplay/scripts/helmcharts/databases/charts/clickhouse/templates/statefulset.yaml
rjshrjndrn 408c3122d3 fix(clickhouse): update user config mount paths
Properly mount clickhouse user configuration files to the users.d
directory with correct paths for each file. Also adds several
performance-related settings to the default user profile including
query cache and JSON type support.

Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
2025-04-14 15:37:55 +02:00

113 lines
3.9 KiB
YAML

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "clickhouse.fullname" . }}
labels:
{{- include "clickhouse.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "clickhouse.fullname" . }}
selector:
matchLabels:
{{- include "clickhouse.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "clickhouse.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "clickhouse.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-backup
env:
- name: CLICKHOUSE_USER
value: "{{ .Values.username }}"
- name: CLICKHOUSE_PASSWORD
value: "{{ .Values.password }}"
{{- range $key, $value := .Values.backupEnv }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.backupImage.repository }}:{{ .Values.backupImage.tag }}"
imagePullPolicy: {{ .Values.backupImage.pullPolicy }}
args:
- server
ports:
- containerPort: 7171
name: backup-web
volumeMounts:
- name: default-chi-openreplay-clickhouse-replicated-0-0-0
mountPath: /var/lib/clickhouse
- name: {{ .Chart.Name }}
env:
- name: CLICKHOUSE_USER
value: "{{ .Values.username }}"
- name: CLICKHOUSE_PASSWORD
value: "{{ .Values.password }}"
- name: CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT
value: "1"
{{- range $key, $value := .Values.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 9000
name: web
- containerPort: 8123
name: data
volumeMounts:
- name: default-chi-openreplay-clickhouse-replicated-0-0-0
mountPath: /var/lib/clickhouse
- name: clickhouse-override-server-config
mountPath: /etc/clickhouse-server/config.d
{{- range $filename, $_ := .Values.configOverride.userConfig }}
- name: clickhouse-override-user-config
mountPath: /etc/clickhouse-server/users.d/{{$filename}}
subPath: {{$filename}}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: clickhouse-override-server-config
configMap:
name: clickhouse-server-override
optional: true
- name: clickhouse-override-user-config
configMap:
name: clickhouse-user-override
optional: true
volumeClaimTemplates:
- metadata:
name: default-chi-openreplay-clickhouse-replicated-0-0-0
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.storageSize }}