blob: 7ca207f7e9161cdaadd6a90dfb307dfe2e0411cc [file] [log] [blame]
vaibhavjayasea9aee02018-08-31 06:22:26 +00001# 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
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 }}"
23 release: "{{ .Release.Name }}"
24 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" . }}
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:
Jerry Floodf406ab82018-10-23 07:10:48 -040043 name: {{ include "common.fullname" . }}-external-config
vitalied1e5876c2018-03-29 10:24:27 -050044 {{- end}}
45 - name: localtime
46 hostPath:
47 path: /etc/localtime
48 imagePullSecrets:
49 - name: {{ include "common.namespace" . }}-docker-registry-key
50 containers:
pramod47b1b822018-08-28 15:41:45 +000051 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000052 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
vitalied1e5876c2018-03-29 10:24:27 -050053 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 Elliott4c88b2d2018-09-13 09:32:08 -040076 name: {{ .Values.service.portName }}
vitalied1e5876c2018-03-29 10:24:27 -050077 - containerPort: {{ .Values.service.sstPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040078 name: {{ .Values.service.sstPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050079 - containerPort: {{ .Values.service.replicationPort }}
80 name: {{ .Values.service.replicationName }}
81 - containerPort: {{ .Values.service.istPort }}
Mike Elliott4c88b2d2018-09-13 09:32:08 -040082 name: {{ .Values.service.istPortName }}
vitalied1e5876c2018-03-29 10:24:27 -050083 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:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000098{{ include "common.resources" . | indent 12 }}
vitalied1e5876c2018-03-29 10:24:27 -050099 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
vitalied1e5876c2018-03-29 10:24:27 -0500110 initContainers:
111 - name: mariadb-galera-prepare
BorislavGdf11cd52018-05-06 12:55:20 +0000112 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
vitalied1e5876c2018-03-29 10:24:27 -0500113 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
pramod47b1b822018-08-28 15:41:45 +0000120 labels:
121 name: {{ include "common.fullname" . }}
vitalied1e5876c2018-03-29 10:24:27 -0500122 spec:
123 accessModes:
124 - {{ .Values.persistence.accessMode | quote }}
pramod47b1b822018-08-28 15:41:45 +0000125 storageClassName: {{ include "common.fullname" . }}-data
vitalied1e5876c2018-03-29 10:24:27 -0500126 resources:
127 requests:
128 storage: {{ .Values.persistence.size | quote }}
Alexis de Talhouët634b4552018-10-28 21:56:33 -0400129 selector:
130 matchLabels:
131 name: {{ include "common.fullname" . }}
BorislavGdf11cd52018-05-06 12:55:20 +0000132{{- end }}