Add Helm Chart Standardization for Clamp
[oom.git] / kubernetes / clamp / charts / mariadb / templates / deployment.yaml
1 apiVersion: extensions/v1beta1
2 kind: Deployment
3 metadata:
4   name: {{ include "common.fullname" . }}
5   namespace: {{ include "common.namespace" . }}
6   labels:
7     app: {{ include "common.name" . }}
8     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
9     release: {{ .Release.Name }}
10     heritage: {{ .Release.Service }}
11 spec:
12   replicas: {{ .Values.replicaCount }}
13   template:
14     metadata:
15       labels:
16         app: {{ include "common.name" . }}
17         release: {{ .Release.Name }}
18     spec:
19       containers:
20         - name: {{ include "common.name" .  }}
21           image: {{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}
22           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
23           ports:
24           - containerPort: {{ .Values.service.internalPort }}
25           # disable liveness probe when breakpoints set in debugger
26           # so K8s doesn't restart unresponsive container
27           {{- if eq .Values.liveness.enabled true }}
28           livenessProbe:
29             tcpSocket:
30               port: {{ .Values.service.internalPort }}
31             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
32             periodSeconds: {{ .Values.liveness.periodSeconds }}
33           {{ end -}}
34           readinessProbe:
35             tcpSocket:
36               port: {{ .Values.service.internalPort }}
37             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
38             periodSeconds: {{ .Values.readiness.periodSeconds }}
39           env:
40             - name: MYSQL_ROOT_PASSWORD
41               valueFrom:
42                 secretKeyRef:
43                   name: {{ template "common.fullname" . }}
44                   key: db-root-password
45           volumeMounts:
46           - mountPath: /docker-entrypoint-initdb.d/load-sql-files-tests-automation.sh
47             name: docker-entrypoint-initdb
48             subPath: load-sql-files-tests-automation.sh
49           - mountPath: /etc/localtime
50             name: localtime
51             readOnly: true
52           - mountPath: /docker-entrypoint-initdb.d/drop/
53             name: docker-entrypoint-clds-drop
54           - mountPath: /docker-entrypoint-initdb.d/bulkload/
55             name: docker-entrypoint-bulkload
56           - mountPath: /etc/mysql/conf.d/conf1/
57             name:  clamp-mariadb-conf
58           - mountPath: /var/lib/mysql
59             name: clamp-mariadb-data
60           resources:
61 {{ toYaml .Values.resources | indent 12 }}
62         {{- if .Values.nodeSelector }}
63         nodeSelector:
64 {{ toYaml .Values.nodeSelector | indent 10 }}
65         {{- end -}}
66         {{- if .Values.affinity }}
67         affinity:
68 {{ toYaml .Values.affinity | indent 10 }}
69         {{- end }}
70       volumes:
71       {{- if .Values.persistence.enabled }}
72         - name: clamp-mariadb-data
73           persistentVolumeClaim:
74             claimName: {{ include "common.fullname" . }}
75       {{- else }}
76           emptyDir: {}
77       {{- end }}
78         - name: docker-entrypoint-initdb
79           configMap:
80             name: clamp-entrypoint-initdb-configmap
81         - name: docker-entrypoint-clds-drop
82           configMap:
83             name: clamp-entrypoint-drop-configmap
84         - name: docker-entrypoint-bulkload
85           configMap:
86             name: clamp-entrypoint-bulkload-configmap
87         - name: clamp-mariadb-conf
88           configMap:
89             name: clamp-mariadb-conf-configmap
90         - name: localtime
91           hostPath:
92             path: /etc/localtime
93       imagePullSecrets:
94       - name: "{{ include "common.namespace" . }}-docker-registry-key"