github.com/castai/kvisor@v1.7.1-0.20240516114728-b3572a2607b5/charts/kvisor/templates/clickhouse.yaml (about) 1 {{- if .Values.clickhouse.enabled }} 2 apiVersion: apps/v1 3 kind: StatefulSet 4 metadata: 5 name: {{ include "kvisor.clickhouse.fullname" . }} 6 namespace: {{ .Release.Namespace }} 7 labels: 8 {{- include "kvisor.clickhouse.labels" . | nindent 4 }} 9 spec: 10 replicas: 1 11 serviceName: clickhouse 12 selector: 13 matchLabels: 14 {{- include "kvisor.clickhouse.selectorLabels" . | nindent 6 }} 15 template: 16 metadata: 17 annotations: 18 checksum/config: {{ include (print $.Template.BasePath "/clickhouse-config.yaml") . | sha256sum }} 19 labels: 20 {{- include "kvisor.clickhouse.selectorLabels" . | nindent 8 }} 21 {{- include "kvisor.commonLabels" . | nindent 8 }} 22 spec: 23 {{- with .Values.imagePullSecrets }} 24 imagePullSecrets: 25 {{- toYaml . | nindent 8 }} 26 {{- end }} 27 securityContext: {} 28 containers: 29 - name: schema 30 image: "{{ .Values.image.repository }}-agent:{{ .Values.image.tag | default .Chart.AppVersion }}" 31 command: 32 - "/usr/local/bin/kvisor-agent" 33 args: 34 - "clickhouse-init" 35 - "--clickhouse-addr=127.0.0.1:9000" 36 - "--clickhouse-database={{.Values.clickhouse.auth.database}}" 37 - "--clickhouse-username={{.Values.clickhouse.auth.username}}" 38 envFrom: 39 - secretRef: 40 name: {{ include "kvisor.clickhouse.fullname" . }} 41 - name: storage 42 securityContext: {} 43 image: "{{ .Values.clickhouse.image.repository }}:{{ .Values.clickhouse.image.tag | default .Chart.AppVersion }}" 44 imagePullPolicy: {{ .Values.clickhouse.image.pullPolicy }} 45 env: 46 - name: CLICKHOUSE_USER 47 value: {{.Values.clickhouse.auth.username}} 48 - name: CLICKHOUSE_DB 49 value: {{.Values.clickhouse.auth.database}} 50 - name: CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT 51 value: "1" 52 envFrom: 53 - secretRef: 54 name: {{ include "kvisor.clickhouse.fullname" . }} 55 volumeMounts: 56 - mountPath: /var/lib/clickhouse 57 name: storage 58 - name: config 59 mountPath: /etc/clickhouse-server/config.d 60 ports: 61 - containerPort: 9000 62 name: native 63 protocol: TCP 64 - containerPort: 8123 65 name: http 66 protocol: TCP 67 livenessProbe: 68 httpGet: 69 port: 8123 70 path: /ping 71 initialDelaySeconds: 60 72 periodSeconds: 10 73 readinessProbe: 74 httpGet: 75 port: 8123 76 path: /ping 77 initialDelaySeconds: 5 78 periodSeconds: 5 79 dnsPolicy: {{.Values.clickhouse.dnsPolicy}} 80 volumes: 81 - name: storage 82 persistentVolumeClaim: 83 claimName: {{ include "kvisor.clickhouse.fullname" . }} 84 - name: config 85 configMap: 86 name: {{ include "kvisor.clickhouse.fullname" . }} 87 {{- with .Values.clickhouse.nodeSelector }} 88 nodeSelector: 89 {{- toYaml . | nindent 8 }} 90 {{- end }} 91 {{- with .Values.clickhouse.affinity }} 92 affinity: 93 {{- toYaml . | nindent 8 }} 94 {{- end }} 95 {{- with .Values.clickhouse.tolerations }} 96 tolerations: 97 {{- toYaml . | nindent 8 }} 98 {{- end }} 99 --- 100 apiVersion: v1 101 kind: Service 102 metadata: 103 name: {{ include "kvisor.clickhouse.fullname" . }} 104 namespace: {{ .Release.Namespace }} 105 spec: 106 ports: 107 - port: 9000 108 name: native 109 targetPort: native 110 protocol: TCP 111 - port: 8123 112 name: http 113 targetPort: http 114 protocol: TCP 115 selector: 116 {{- include "kvisor.clickhouse.selectorLabels" . | nindent 6 }} 117 type: ClusterIP 118 --- 119 apiVersion: v1 120 kind: PersistentVolumeClaim 121 metadata: 122 name: {{ include "kvisor.clickhouse.fullname" . }} 123 namespace: {{ .Release.Namespace }} 124 spec: 125 accessModes: 126 - ReadWriteOnce 127 {{- if .Values.clickhouse.persistentVolume.storageClass }} 128 storageClassName: {{ .Values.clickhouse.persistentVolume.storageClass }} 129 {{- end }} 130 resources: 131 requests: 132 storage: {{ .Values.clickhouse.persistentVolume.size }} 133 --- 134 apiVersion: v1 135 kind: Secret 136 metadata: 137 name: {{ include "kvisor.clickhouse.fullname" . }} 138 namespace: {{ .Release.Namespace }} 139 data: 140 CLICKHOUSE_PASSWORD: {{ .Values.clickhouse.auth.password | b64enc | quote }} 141 {{- end }}