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 }} env: {{- 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: ch-volume mountPath: /var/lib/mydata 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 }} volumeClaimTemplates: - metadata: name: ch-volume spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: {{ .Values.storageSize }}