vaibhavjayas | ea9aee0 | 2018-08-31 06:22:26 +0000 | [diff] [blame] | 1 | # Copyright © 2018 Amdocs, Bell Canada |
| 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" . }} |
| 32 | annotations: |
| 33 | pod.alpha.kubernetes.io/initialized: "true" |
| 34 | spec: |
| 35 | {{- if .Values.nodeSelector }} |
| 36 | nodeSelector: |
| 37 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 38 | {{- end }} |
| 39 | volumes: |
| 40 | {{- if .Values.externalConfig }} |
| 41 | - name: config |
| 42 | configMap: |
| 43 | name: {{ include "common.fullname" . }}-externalConfig |
| 44 | {{- end}} |
| 45 | - name: localtime |
| 46 | hostPath: |
| 47 | path: /etc/localtime |
| 48 | imagePullSecrets: |
| 49 | - name: {{ include "common.namespace" . }}-docker-registry-key |
| 50 | containers: |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 51 | - name: {{ include "common.name" . }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 52 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 53 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}} |
| 54 | env: |
| 55 | - name: POD_NAMESPACE |
| 56 | valueFrom: |
| 57 | fieldRef: |
| 58 | apiVersion: v1 |
| 59 | fieldPath: metadata.namespace |
| 60 | - name: MYSQL_USER |
| 61 | value: {{ default "" .Values.config.userName | quote }} |
| 62 | - name: MYSQL_PASSWORD |
| 63 | valueFrom: |
| 64 | secretKeyRef: |
| 65 | name: {{ template "common.fullname" . }} |
| 66 | key: user-password |
| 67 | - name: MYSQL_DATABASE |
| 68 | value: {{ default "" .Values.config.mysqlDatabase | quote }} |
| 69 | - name: MYSQL_ROOT_PASSWORD |
| 70 | valueFrom: |
| 71 | secretKeyRef: |
| 72 | name: {{ template "common.fullname" . }} |
| 73 | key: db-root-password |
| 74 | ports: |
| 75 | - containerPort: {{ .Values.service.internalPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 76 | name: {{ .Values.service.portName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 77 | - containerPort: {{ .Values.service.sstPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 78 | name: {{ .Values.service.sstPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 79 | - containerPort: {{ .Values.service.replicationPort }} |
| 80 | name: {{ .Values.service.replicationName }} |
| 81 | - containerPort: {{ .Values.service.istPort }} |
Mike Elliott | 4c88b2d | 2018-09-13 09:32:08 -0400 | [diff] [blame] | 82 | name: {{ .Values.service.istPortName }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 83 | readinessProbe: |
| 84 | exec: |
| 85 | command: |
| 86 | - /usr/share/container-scripts/mysql/readiness-probe.sh |
| 87 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 88 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 89 | {{- if eq .Values.liveness.enabled true }} |
| 90 | livenessProbe: |
| 91 | exec: |
| 92 | command: ["mysqladmin", "ping"] |
| 93 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 94 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 95 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
| 96 | {{- end }} |
| 97 | resources: |
| 98 | {{ toYaml .Values.resources | indent 12 }} |
| 99 | volumeMounts: |
| 100 | {{- if .Values.externalConfig }} |
| 101 | - mountPath: /etc/config |
| 102 | name: config |
| 103 | {{- end}} |
| 104 | - mountPath: /etc/localtime |
| 105 | name: localtime |
| 106 | readOnly: true |
| 107 | {{- if .Values.persistence.enabled }} |
| 108 | - mountPath: /var/lib/mysql |
| 109 | name: {{ include "common.fullname" . }}-data |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 110 | initContainers: |
| 111 | - name: mariadb-galera-prepare |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 112 | image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}" |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 113 | command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"] |
| 114 | volumeMounts: |
| 115 | - name: {{ include "common.fullname" . }}-data |
| 116 | mountPath: /var/lib/mysql |
| 117 | volumeClaimTemplates: |
| 118 | - metadata: |
| 119 | name: {{ include "common.fullname" . }}-data |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 120 | labels: |
| 121 | name: {{ include "common.fullname" . }} |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 122 | spec: |
| 123 | accessModes: |
| 124 | - {{ .Values.persistence.accessMode | quote }} |
pramod | 47b1b82 | 2018-08-28 15:41:45 +0000 | [diff] [blame] | 125 | storageClassName: {{ include "common.fullname" . }}-data |
vitalied | 1e5876c | 2018-03-29 10:24:27 -0500 | [diff] [blame] | 126 | resources: |
| 127 | requests: |
| 128 | storage: {{ .Values.persistence.size | quote }} |
BorislavG | df11cd5 | 2018-05-06 12:55:20 +0000 | [diff] [blame] | 129 | {{- end }} |