blob: 855d50e5ea20f8cb76190abc2956a4300ec7cf37 [file] [log] [blame]
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +01001{{/*
Krzysztof Opasiak01c975b2019-12-16 17:42:38 +01002# Copyright © 2019 Amdocs, Bell Canada, Orange, Samsung Electronics
vaibhavjayasea9aee02018-08-31 06:22:26 +00003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010015*/}}
vaibhavjayasea9aee02018-08-31 06:22:26 +000016
vitalied1e5876c2018-03-29 10:24:27 -050017apiVersion: apps/v1beta1
18kind: StatefulSet
19metadata:
20 name: {{ include "common.fullname" . }}
21 namespace: {{ include "common.namespace" . }}
22 labels:
23 app: {{ include "common.fullname" . }}
24 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010025 release: "{{ include "common.release" . }}"
vitalied1e5876c2018-03-29 10:24:27 -050026 heritage: "{{ .Release.Service }}"
27spec:
pramod47b1b822018-08-28 15:41:45 +000028 serviceName: {{ .Values.service.name }}
vitalied1e5876c2018-03-29 10:24:27 -050029 replicas: {{ .Values.replicaCount }}
30 template:
31 metadata:
32 labels:
33 app: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +053034 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010035 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +053036 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -050037 annotations:
38 pod.alpha.kubernetes.io/initialized: "true"
39 spec:
40 {{- if .Values.nodeSelector }}
41 nodeSelector:
42{{ toYaml .Values.nodeSelector | indent 8 }}
43 {{- end }}
44 volumes:
45 {{- if .Values.externalConfig }}
46 - name: config
47 configMap:
Jerry Floodf406ab82018-10-23 07:10:48 -040048 name: {{ include "common.fullname" . }}-external-config
vitalied1e5876c2018-03-29 10:24:27 -050049 {{- end}}
Krzysztof Opasiakf5e74e52020-04-23 00:11:44 +020050 - name: init-script
51 configMap:
52 name: {{ include "common.fullname" . }}
53 defaultMode: 0755
vitalied1e5876c2018-03-29 10:24:27 -050054 - name: localtime
55 hostPath:
56 path: /etc/localtime
57 imagePullSecrets:
58 - name: {{ include "common.namespace" . }}-docker-registry-key
59 containers:
pramod47b1b822018-08-28 15:41:45 +000060 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000061 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
vitalied1e5876c2018-03-29 10:24:27 -050062 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
63 env:
64 - name: POD_NAMESPACE
65 valueFrom:
66 fieldRef:
67 apiVersion: v1
68 fieldPath: metadata.namespace
69 - name: MYSQL_USER
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010070 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050071 - name: MYSQL_PASSWORD
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010072 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050073 - name: MYSQL_DATABASE
74 value: {{ default "" .Values.config.mysqlDatabase | quote }}
75 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010076 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050077 ports:
78 - containerPort: {{ .Values.service.internalPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040079 name: {{ .Values.service.portName }}
vitalied1e5876c2018-03-29 10:24:27 -050080 - containerPort: {{ .Values.service.sstPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040081 name: {{ .Values.service.sstPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050082 - containerPort: {{ .Values.service.replicationPort }}
83 name: {{ .Values.service.replicationName }}
84 - containerPort: {{ .Values.service.istPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040085 name: {{ .Values.service.istPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050086 readinessProbe:
87 exec:
88 command:
89 - /usr/share/container-scripts/mysql/readiness-probe.sh
90 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
91 periodSeconds: {{ .Values.readiness.periodSeconds }}
yangyane63c9212019-05-22 13:04:15 +080092 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
vitalied1e5876c2018-03-29 10:24:27 -050093 {{- if eq .Values.liveness.enabled true }}
94 livenessProbe:
95 exec:
96 command: ["mysqladmin", "ping"]
97 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
98 periodSeconds: {{ .Values.liveness.periodSeconds }}
99 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
100 {{- end }}
101 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +0000102{{ include "common.resources" . | indent 12 }}
vitalied1e5876c2018-03-29 10:24:27 -0500103 volumeMounts:
104 {{- if .Values.externalConfig }}
105 - mountPath: /etc/config
106 name: config
107 {{- end}}
108 - mountPath: /etc/localtime
109 name: localtime
110 readOnly: true
Krzysztof Opasiakf5e74e52020-04-23 00:11:44 +0200111 - mountPath: /usr/share/container-scripts/mysql/configure-mysql.sh
112 subPath: configure-mysql.sh
113 name: init-script
vitalied1e5876c2018-03-29 10:24:27 -0500114{{- if .Values.persistence.enabled }}
115 - mountPath: /var/lib/mysql
116 name: {{ include "common.fullname" . }}-data
vitalied1e5876c2018-03-29 10:24:27 -0500117 initContainers:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100118 - name: {{ include "common.name" . }}-prepare
BorislavGdf11cd52018-05-06 12:55:20 +0000119 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
mahendrr91fc6a92019-04-12 07:11:32 +0000120 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
vitalied1e5876c2018-03-29 10:24:27 -0500121 command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
122 volumeMounts:
123 - name: {{ include "common.fullname" . }}-data
124 mountPath: /var/lib/mysql
125 volumeClaimTemplates:
126 - metadata:
127 name: {{ include "common.fullname" . }}-data
pramod47b1b822018-08-28 15:41:45 +0000128 labels:
129 name: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +0530130 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100131 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +0530132 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -0500133 spec:
134 accessModes:
135 - {{ .Values.persistence.accessMode | quote }}
Sylvain Desbureaux524c8782019-11-08 17:36:02 +0100136 storageClassName: {{ include "common.storageClass" . }}
vitalied1e5876c2018-03-29 10:24:27 -0500137 resources:
138 requests:
139 storage: {{ .Values.persistence.size | quote }}
BorislavGdf11cd52018-05-06 12:55:20 +0000140{{- end }}