blob: 5f96ee658e7be75911614ab2f040b6ae2b9d0f2b [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:
26 serviceName: {{ include "common.fullname" . }}
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:
51 - name: {{ include "common.fullname" . }}
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 }}
76 name: {{ .Values.service.name }}
77 - containerPort: {{ .Values.service.sstPort }}
78 name: {{ .Values.service.sstName }}
79 - containerPort: {{ .Values.service.replicationPort }}
80 name: {{ .Values.service.replicationName }}
81 - containerPort: {{ .Values.service.istPort }}
82 name: {{ .Values.service.istName }}
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
110 subPath: data
111 initContainers:
112 - name: mariadb-galera-prepare
BorislavGdf11cd52018-05-06 12:55:20 +0000113 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
vitalied1e5876c2018-03-29 10:24:27 -0500114 command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
115 volumeMounts:
116 - name: {{ include "common.fullname" . }}-data
117 mountPath: /var/lib/mysql
118 volumeClaimTemplates:
119 - metadata:
120 name: {{ include "common.fullname" . }}-data
121 annotations:
122 {{- if .Values.persistence.storageClass }}
123 volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
124 {{- else }}
125 volume.alpha.kubernetes.io/storage-class: default
126 {{- end }}
127 spec:
128 accessModes:
129 - {{ .Values.persistence.accessMode | quote }}
130 resources:
131 requests:
132 storage: {{ .Values.persistence.size | quote }}
BorislavGdf11cd52018-05-06 12:55:20 +0000133{{- end }}