Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame^] | 1 | # Copyright © 2019 Amdocs, Bell Canada, Orange |
vaibhavjayas | ea9aee0 | 2018-08-31 06:22:26 +0000 | [diff] [blame] | 2 | # |
| 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 | |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 15 | apiVersion: apps/v1beta1 |
| 16 | kind: StatefulSet |
| 17 | metadata: |
| 18 | name: {{ include "common.fullname" . }} |
| 19 | namespace: {{ include "common.namespace" . }} |
| 20 | labels: |
| 21 | app: {{ include "common.fullname" . }} |
| 22 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 23 | release: "{{ .Release.Name }}" |
| 24 | heritage: "{{ .Release.Service }}" |
| 25 | spec: |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 26 | serviceName: {{ .Values.service.name }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 27 | replicas: {{ .Values.replicaCount }} |
| 28 | template: |
| 29 | metadata: |
| 30 | labels: |
| 31 | app: {{ include "common.fullname" . }} |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 32 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 33 | release: "{{ .Release.Name }}" |
| 34 | heritage: "{{ .Release.Service }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 35 | 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 Flood | f406ab8 | 2018-10-23 07:10:48 -0400 | [diff] [blame] | 46 | name: {{ include "common.fullname" . }}-external-config |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 47 | {{- end}} |
| 48 | - name: localtime |
| 49 | hostPath: |
| 50 | path: /etc/localtime |
| 51 | imagePullSecrets: |
| 52 | - name: {{ include "common.namespace" . }}-docker-registry-key |
| 53 | containers: |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 54 | - name: {{ include "common.name" . }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 55 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 56 | 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 |
| 64 | value: {{ default "" .Values.config.userName | quote }} |
| 65 | - name: MYSQL_PASSWORD |
| 66 | valueFrom: |
| 67 | secretKeyRef: |
| 68 | name: {{ template "common.fullname" . }} |
| 69 | key: user-password |
| 70 | - name: MYSQL_DATABASE |
| 71 | value: {{ default "" .Values.config.mysqlDatabase | quote }} |
| 72 | - name: MYSQL_ROOT_PASSWORD |
| 73 | valueFrom: |
| 74 | secretKeyRef: |
| 75 | name: {{ template "common.fullname" . }} |
| 76 | key: db-root-password |
| 77 | ports: |
| 78 | - containerPort: {{ .Values.service.internalPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 79 | name: {{ .Values.service.portName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 80 | - containerPort: {{ .Values.service.sstPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 81 | name: {{ .Values.service.sstPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 82 | - containerPort: {{ .Values.service.replicationPort }} |
| 83 | name: {{ .Values.service.replicationName }} |
| 84 | - containerPort: {{ .Values.service.istPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 85 | name: {{ .Values.service.istPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 86 | readinessProbe: |
| 87 | exec: |
| 88 | command: |
| 89 | - /usr/share/container-scripts/mysql/readiness-probe.sh |
| 90 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 91 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
yangyan | e63c921 | 2019-05-22 13:04:15 +0800 | [diff] [blame] | 92 | timeoutSeconds: {{ .Values.readiness.timeoutSeconds }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 93 | {{- 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 Khinda | 5e3f36a | 2018-09-24 15:25:42 +0000 | [diff] [blame] | 102 | {{ include "common.resources" . | indent 12 }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 103 | volumeMounts: |
| 104 | {{- if .Values.externalConfig }} |
| 105 | - mountPath: /etc/config |
| 106 | name: config |
| 107 | {{- end}} |
| 108 | - mountPath: /etc/localtime |
| 109 | name: localtime |
| 110 | readOnly: true |
| 111 | {{- if .Values.persistence.enabled }} |
| 112 | - mountPath: /var/lib/mysql |
| 113 | name: {{ include "common.fullname" . }}-data |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 114 | initContainers: |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame^] | 115 | - name: {{ include "common.name" . }}-prepare |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 116 | image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}" |
mahendrr | 91fc6a9 | 2019-04-12 07:11:32 +0000 | [diff] [blame] | 117 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 118 | command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"] |
| 119 | volumeMounts: |
| 120 | - name: {{ include "common.fullname" . }}-data |
| 121 | mountPath: /var/lib/mysql |
| 122 | volumeClaimTemplates: |
| 123 | - metadata: |
| 124 | name: {{ include "common.fullname" . }}-data |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 125 | labels: |
| 126 | name: {{ include "common.fullname" . }} |
sushil masal | 08ef709 | 2019-02-21 16:21:51 +0530 | [diff] [blame] | 127 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
| 128 | release: "{{ .Release.Name }}" |
| 129 | heritage: "{{ .Release.Service }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 130 | spec: |
| 131 | accessModes: |
| 132 | - {{ .Values.persistence.accessMode | quote }} |
Sylvain Desbureaux | 524c878 | 2019-11-08 17:36:02 +0100 | [diff] [blame] | 133 | storageClassName: {{ include "common.storageClass" . }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 134 | resources: |
| 135 | requests: |
| 136 | storage: {{ .Values.persistence.size | quote }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 137 | {{- end }} |