Krzysztof Opasiak | c0a57f8 | 2020-03-23 15:50:13 +0100 | [diff] [blame] | 1 | {{/* |
Krzysztof Opasiak | 01c975b | 2019-12-16 17:42:38 +0100 | [diff] [blame] | 2 | # Copyright © 2019 Amdocs, Bell Canada, Orange, Samsung Electronics |
vaibhavjayas | ea9aee0 | 2018-08-31 06:22:26 +0000 | [diff] [blame] | 3 | # |
| 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 Opasiak | c0a57f8 | 2020-03-23 15:50:13 +0100 | [diff] [blame] | 15 | */}} |
vaibhavjayas | ea9aee0 | 2018-08-31 06:22:26 +0000 | [diff] [blame] | 16 | |
milaszki | 804afe7 | 2020-07-07 12:23:07 +0000 | [diff] [blame] | 17 | apiVersion: apps/v1 |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 18 | kind: StatefulSet |
| 19 | metadata: |
| 20 | name: {{ include "common.fullname" . }} |
| 21 | namespace: {{ include "common.namespace" . }} |
| 22 | labels: |
| 23 | app: {{ include "common.fullname" . }} |
| 24 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 25 | release: "{{ include "common.release" . }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 26 | heritage: "{{ .Release.Service }}" |
| 27 | spec: |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 28 | serviceName: {{ .Values.service.name }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 29 | replicas: {{ .Values.replicaCount }} |
milaszki | 804afe7 | 2020-07-07 12:23:07 +0000 | [diff] [blame] | 30 | selector: |
| 31 | matchLabels: |
| 32 | app: {{ include "common.fullname" . }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 33 | template: |
| 34 | metadata: |
| 35 | labels: |
| 36 | app: {{ include "common.fullname" . }} |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 37 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 38 | release: "{{ include "common.release" . }}" |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 39 | heritage: "{{ .Release.Service }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 40 | 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 Flood | f406ab8 | 2018-10-23 07:10:48 -0400 | [diff] [blame] | 51 | name: {{ include "common.fullname" . }}-external-config |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 52 | {{- end}} |
Krzysztof Opasiak | f5e74e5 | 2020-04-23 00:11:44 +0200 | [diff] [blame] | 53 | - name: init-script |
| 54 | configMap: |
| 55 | name: {{ include "common.fullname" . }} |
| 56 | defaultMode: 0755 |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 57 | - name: localtime |
| 58 | hostPath: |
| 59 | path: /etc/localtime |
| 60 | imagePullSecrets: |
| 61 | - name: {{ include "common.namespace" . }}-docker-registry-key |
| 62 | containers: |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 63 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 4106614 | 2020-11-19 17:12:46 +0100 | [diff] [blame] | 64 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 65 | 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 Opasiak | c0a57f8 | 2020-03-23 15:50:13 +0100 | [diff] [blame] | 73 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 74 | - name: MYSQL_PASSWORD |
Krzysztof Opasiak | c0a57f8 | 2020-03-23 15:50:13 +0100 | [diff] [blame] | 75 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 76 | - name: MYSQL_DATABASE |
| 77 | value: {{ default "" .Values.config.mysqlDatabase | quote }} |
| 78 | - name: MYSQL_ROOT_PASSWORD |
Krzysztof Opasiak | c0a57f8 | 2020-03-23 15:50:13 +0100 | [diff] [blame] | 79 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 80 | ports: |
| 81 | - containerPort: {{ .Values.service.internalPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 82 | name: {{ .Values.service.portName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 83 | - containerPort: {{ .Values.service.sstPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 84 | name: {{ .Values.service.sstPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 85 | - containerPort: {{ .Values.service.replicationPort }} |
| 86 | name: {{ .Values.service.replicationName }} |
| 87 | - containerPort: {{ .Values.service.istPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 88 | name: {{ .Values.service.istPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 89 | readinessProbe: |
| 90 | exec: |
| 91 | command: |
| 92 | - /usr/share/container-scripts/mysql/readiness-probe.sh |
| 93 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 94 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
yangyan | e63c921 | 2019-05-22 13:04:15 +0800 | [diff] [blame] | 95 | timeoutSeconds: {{ .Values.readiness.timeoutSeconds }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 96 | {{- 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 Khinda | 5e3f36a | 2018-09-24 15:25:42 +0000 | [diff] [blame] | 105 | {{ include "common.resources" . | indent 12 }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 106 | 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 Opasiak | f5e74e5 | 2020-04-23 00:11:44 +0200 | [diff] [blame] | 114 | - mountPath: /usr/share/container-scripts/mysql/configure-mysql.sh |
| 115 | subPath: configure-mysql.sh |
| 116 | name: init-script |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 117 | {{- if .Values.persistence.enabled }} |
| 118 | - mountPath: /var/lib/mysql |
| 119 | name: {{ include "common.fullname" . }}-data |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 120 | initContainers: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 121 | - name: {{ include "common.name" . }}-prepare |
Sylvain Desbureaux | 4106614 | 2020-11-19 17:12:46 +0100 | [diff] [blame] | 122 | image: {{ include "repositoryGenerator.image.busybox" . }} |
mahendrr | 91fc6a9 | 2019-04-12 07:11:32 +0000 | [diff] [blame] | 123 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 124 | 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 |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 131 | labels: |
| 132 | name: {{ include "common.fullname" . }} |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 133 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 134 | release: "{{ include "common.release" . }}" |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 135 | heritage: "{{ .Release.Service }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 136 | spec: |
| 137 | accessModes: |
| 138 | - {{ .Values.persistence.accessMode | quote }} |
Sylvain Desbureaux | 524c878 | 2019-11-08 17:36:02 +0100 | [diff] [blame] | 139 | storageClassName: {{ include "common.storageClass" . }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 140 | resources: |
| 141 | requests: |
| 142 | storage: {{ .Values.persistence.size | quote }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 143 | {{- end }} |