blob: a6260fae543d0d71e2b1bd94ff62f4c7b5d4931f [file] [log] [blame]
Krzysztof Opasiak01c975b2019-12-16 17:42:38 +01001# Copyright © 2019 Amdocs, Bell Canada, Orange, Samsung Electronics
vaibhavjayasea9aee02018-08-31 06:22:26 +00002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
vitalied1e5876c2018-03-29 10:24:27 -050015apiVersion: apps/v1beta1
16kind: StatefulSet
17metadata:
18 name: {{ include "common.fullname" . }}
19 namespace: {{ include "common.namespace" . }}
20 labels:
21 app: {{ include "common.fullname" . }}
22 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010023 release: "{{ include "common.release" . }}"
vitalied1e5876c2018-03-29 10:24:27 -050024 heritage: "{{ .Release.Service }}"
25spec:
pramod47b1b822018-08-28 15:41:45 +000026 serviceName: {{ .Values.service.name }}
vitalied1e5876c2018-03-29 10:24:27 -050027 replicas: {{ .Values.replicaCount }}
28 template:
29 metadata:
30 labels:
31 app: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +053032 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010033 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +053034 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -050035 annotations:
36 pod.alpha.kubernetes.io/initialized: "true"
37 spec:
38 {{- if .Values.nodeSelector }}
39 nodeSelector:
40{{ toYaml .Values.nodeSelector | indent 8 }}
41 {{- end }}
42 volumes:
43 {{- if .Values.externalConfig }}
44 - name: config
45 configMap:
Jerry Floodf406ab82018-10-23 07:10:48 -040046 name: {{ include "common.fullname" . }}-external-config
vitalied1e5876c2018-03-29 10:24:27 -050047 {{- end}}
48 - name: localtime
49 hostPath:
50 path: /etc/localtime
51 imagePullSecrets:
52 - name: {{ include "common.namespace" . }}-docker-registry-key
53 containers:
pramod47b1b822018-08-28 15:41:45 +000054 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000055 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
vitalied1e5876c2018-03-29 10:24:27 -050056 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
57 env:
58 - name: POD_NAMESPACE
59 valueFrom:
60 fieldRef:
61 apiVersion: v1
62 fieldPath: metadata.namespace
63 - name: MYSQL_USER
Krzysztof Opasiaka789c1a2020-01-22 00:06:32 +010064 {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050065 - name: MYSQL_PASSWORD
Krzysztof Opasiaka789c1a2020-01-22 00:06:32 +010066 {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050067 - name: MYSQL_DATABASE
68 value: {{ default "" .Values.config.mysqlDatabase | quote }}
69 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiaka789c1a2020-01-22 00:06:32 +010070 {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050071 ports:
72 - containerPort: {{ .Values.service.internalPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040073 name: {{ .Values.service.portName }}
vitalied1e5876c2018-03-29 10:24:27 -050074 - containerPort: {{ .Values.service.sstPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040075 name: {{ .Values.service.sstPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050076 - containerPort: {{ .Values.service.replicationPort }}
77 name: {{ .Values.service.replicationName }}
78 - containerPort: {{ .Values.service.istPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040079 name: {{ .Values.service.istPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050080 readinessProbe:
81 exec:
82 command:
83 - /usr/share/container-scripts/mysql/readiness-probe.sh
84 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
85 periodSeconds: {{ .Values.readiness.periodSeconds }}
yangyane63c9212019-05-22 13:04:15 +080086 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
vitalied1e5876c2018-03-29 10:24:27 -050087 {{- if eq .Values.liveness.enabled true }}
88 livenessProbe:
89 exec:
90 command: ["mysqladmin", "ping"]
91 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
92 periodSeconds: {{ .Values.liveness.periodSeconds }}
93 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
94 {{- end }}
95 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000096{{ include "common.resources" . | indent 12 }}
vitalied1e5876c2018-03-29 10:24:27 -050097 volumeMounts:
98 {{- if .Values.externalConfig }}
99 - mountPath: /etc/config
100 name: config
101 {{- end}}
102 - mountPath: /etc/localtime
103 name: localtime
104 readOnly: true
105{{- if .Values.persistence.enabled }}
106 - mountPath: /var/lib/mysql
107 name: {{ include "common.fullname" . }}-data
vitalied1e5876c2018-03-29 10:24:27 -0500108 initContainers:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100109 - name: {{ include "common.name" . }}-prepare
BorislavGdf11cd52018-05-06 12:55:20 +0000110 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
mahendrr91fc6a92019-04-12 07:11:32 +0000111 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
vitalied1e5876c2018-03-29 10:24:27 -0500112 command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
113 volumeMounts:
114 - name: {{ include "common.fullname" . }}-data
115 mountPath: /var/lib/mysql
116 volumeClaimTemplates:
117 - metadata:
118 name: {{ include "common.fullname" . }}-data
pramod47b1b822018-08-28 15:41:45 +0000119 labels:
120 name: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +0530121 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100122 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +0530123 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -0500124 spec:
125 accessModes:
126 - {{ .Values.persistence.accessMode | quote }}
Sylvain Desbureaux524c8782019-11-08 17:36:02 +0100127 storageClassName: {{ include "common.storageClass" . }}
vitalied1e5876c2018-03-29 10:24:27 -0500128 resources:
129 requests:
130 storage: {{ .Values.persistence.size | quote }}
BorislavGdf11cd52018-05-06 12:55:20 +0000131{{- end }}