blob: 47d1e0ef3d7052468925c94ff81ce9fb944903bd [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
milaszki804afe72020-07-07 12:23:07 +000017apiVersion: apps/v1
vitalied1e5876c2018-03-29 10:24:27 -050018kind: 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 }}
milaszki804afe72020-07-07 12:23:07 +000030 selector:
31 matchLabels:
32 app: {{ include "common.fullname" . }}
vitalied1e5876c2018-03-29 10:24:27 -050033 template:
34 metadata:
35 labels:
36 app: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +053037 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010038 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +053039 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -050040 annotations:
41 pod.alpha.kubernetes.io/initialized: "true"
42 spec:
43 {{- if .Values.nodeSelector }}
44 nodeSelector:
45{{ toYaml .Values.nodeSelector | indent 8 }}
46 {{- end }}
47 volumes:
48 {{- if .Values.externalConfig }}
49 - name: config
50 configMap:
Jerry Floodf406ab82018-10-23 07:10:48 -040051 name: {{ include "common.fullname" . }}-external-config
vitalied1e5876c2018-03-29 10:24:27 -050052 {{- end}}
Krzysztof Opasiakf5e74e52020-04-23 00:11:44 +020053 - name: init-script
54 configMap:
55 name: {{ include "common.fullname" . }}
56 defaultMode: 0755
vitalied1e5876c2018-03-29 10:24:27 -050057 - name: localtime
58 hostPath:
59 path: /etc/localtime
60 imagePullSecrets:
61 - name: {{ include "common.namespace" . }}-docker-registry-key
62 containers:
pramod47b1b822018-08-28 15:41:45 +000063 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000064 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
vitalied1e5876c2018-03-29 10:24:27 -050065 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
66 env:
67 - name: POD_NAMESPACE
68 valueFrom:
69 fieldRef:
70 apiVersion: v1
71 fieldPath: metadata.namespace
72 - name: MYSQL_USER
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010073 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050074 - name: MYSQL_PASSWORD
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010075 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050076 - name: MYSQL_DATABASE
77 value: {{ default "" .Values.config.mysqlDatabase | quote }}
78 - name: MYSQL_ROOT_PASSWORD
Krzysztof Opasiakc0a57f82020-03-23 15:50:13 +010079 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}}
vitalied1e5876c2018-03-29 10:24:27 -050080 ports:
81 - containerPort: {{ .Values.service.internalPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040082 name: {{ .Values.service.portName }}
vitalied1e5876c2018-03-29 10:24:27 -050083 - containerPort: {{ .Values.service.sstPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040084 name: {{ .Values.service.sstPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050085 - containerPort: {{ .Values.service.replicationPort }}
86 name: {{ .Values.service.replicationName }}
87 - containerPort: {{ .Values.service.istPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040088 name: {{ .Values.service.istPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050089 readinessProbe:
90 exec:
91 command:
92 - /usr/share/container-scripts/mysql/readiness-probe.sh
93 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
94 periodSeconds: {{ .Values.readiness.periodSeconds }}
yangyane63c9212019-05-22 13:04:15 +080095 timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
vitalied1e5876c2018-03-29 10:24:27 -050096 {{- if eq .Values.liveness.enabled true }}
97 livenessProbe:
98 exec:
99 command: ["mysqladmin", "ping"]
100 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
101 periodSeconds: {{ .Values.liveness.periodSeconds }}
102 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
103 {{- end }}
104 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +0000105{{ include "common.resources" . | indent 12 }}
vitalied1e5876c2018-03-29 10:24:27 -0500106 volumeMounts:
107 {{- if .Values.externalConfig }}
108 - mountPath: /etc/config
109 name: config
110 {{- end}}
111 - mountPath: /etc/localtime
112 name: localtime
113 readOnly: true
Krzysztof Opasiakf5e74e52020-04-23 00:11:44 +0200114 - mountPath: /usr/share/container-scripts/mysql/configure-mysql.sh
115 subPath: configure-mysql.sh
116 name: init-script
vitalied1e5876c2018-03-29 10:24:27 -0500117{{- if .Values.persistence.enabled }}
118 - mountPath: /var/lib/mysql
119 name: {{ include "common.fullname" . }}-data
vitalied1e5876c2018-03-29 10:24:27 -0500120 initContainers:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100121 - name: {{ include "common.name" . }}-prepare
BorislavGdf11cd52018-05-06 12:55:20 +0000122 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
mahendrr91fc6a92019-04-12 07:11:32 +0000123 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
vitalied1e5876c2018-03-29 10:24:27 -0500124 command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
125 volumeMounts:
126 - name: {{ include "common.fullname" . }}-data
127 mountPath: /var/lib/mysql
128 volumeClaimTemplates:
129 - metadata:
130 name: {{ include "common.fullname" . }}-data
pramod47b1b822018-08-28 15:41:45 +0000131 labels:
132 name: {{ include "common.fullname" . }}
sushil masal08ef7092019-02-21 16:21:51 +0530133 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +0100134 release: "{{ include "common.release" . }}"
sushil masal08ef7092019-02-21 16:21:51 +0530135 heritage: "{{ .Release.Service }}"
vitalied1e5876c2018-03-29 10:24:27 -0500136 spec:
137 accessModes:
138 - {{ .Values.persistence.accessMode | quote }}
Sylvain Desbureaux524c8782019-11-08 17:36:02 +0100139 storageClassName: {{ include "common.storageClass" . }}
vitalied1e5876c2018-03-29 10:24:27 -0500140 resources:
141 requests:
142 storage: {{ .Values.persistence.size | quote }}
BorislavGdf11cd52018-05-06 12:55:20 +0000143{{- end }}