blob: 7d6ce6e6768ef54e1c693046137fef9cb2e2ed27 [file] [log] [blame]
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +03001apiVersion: apps/v1beta1
2kind: StatefulSet
3metadata:
4 name: {{ include "common.fullname" . }}
5 namespace: {{ include "common.namespace" . }}
6 labels:
7 app: {{ include "common.fullname" . }}
8 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
9 release: "{{ .Release.Name }}"
10 heritage: "{{ .Release.Service }}"
11spec:
12# serviceName: {{ include "common.fullname" . }}
13 serviceName: {{ .Values.service.name }}
14 replicas: {{ .Values.replicaCount }}
15 template:
16 metadata:
17 labels:
18 app: {{ include "common.fullname" . }}
Hector Anapan-Lavalle3d8a6a12018-08-07 21:31:05 -040019 release: {{ .Release.Name }}
Sonsino, Ofir (os0695)2dda01d2018-05-30 18:41:14 +030020 annotations:
21 pod.alpha.kubernetes.io/initialized: "true"
22 spec:
23 {{- if .Values.nodeSelector }}
24 nodeSelector:
25{{ toYaml .Values.nodeSelector | indent 8 }}
26 {{- end }}
27 volumes:
28 {{- if .Values.externalConfig }}
29 - name: config
30 configMap:
31 name: {{ include "common.fullname" . }}-externalconfig
32 {{- end}}
33 - name: localtime
34 hostPath:
35 path: /etc/localtime
36 imagePullSecrets:
37 - name: {{ include "common.namespace" . }}-docker-registry-key
38 containers:
39 - name: {{ include "common.fullname" . }}
40 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
41 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
42 env:
43 - name: POD_NAMESPACE
44 valueFrom:
45 fieldRef:
46 apiVersion: v1
47 fieldPath: metadata.namespace
48 - name: MYSQL_USER
49 value: {{ default "" .Values.config.userName | quote }}
50 - name: MYSQL_PASSWORD
51 valueFrom:
52 secretKeyRef:
53 name: {{ template "common.fullname" . }}
54 key: user-password
55 - name: MYSQL_DATABASE
56 value: {{ default "" .Values.config.mysqlDatabase | quote }}
57 - name: MYSQL_ROOT_PASSWORD
58 valueFrom:
59 secretKeyRef:
60 name: {{ template "common.fullname" . }}
61 key: db-root-password
62 ports:
63 - containerPort: {{ .Values.service.internalPort }}
64 name: {{ .Values.service.name }}
65 - containerPort: {{ .Values.service.sstPort }}
66 name: {{ .Values.service.sstName }}
67 - containerPort: {{ .Values.service.replicationPort }}
68 name: {{ .Values.service.replicationName }}
69 - containerPort: {{ .Values.service.istPort }}
70 name: {{ .Values.service.istName }}
71 readinessProbe:
72 exec:
73 command:
74 - /usr/share/container-scripts/mysql/readiness-probe.sh
75 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
76 periodSeconds: {{ .Values.readiness.periodSeconds }}
77 {{- if eq .Values.liveness.enabled true }}
78 livenessProbe:
79 exec:
80 command: ["mysqladmin", "ping"]
81 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
82 periodSeconds: {{ .Values.liveness.periodSeconds }}
83 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
84 {{- end }}
85 resources:
86{{ toYaml .Values.resources | indent 12 }}
87 volumeMounts:
88 {{- if .Values.externalConfig }}
89 - mountPath: /etc/config
90 name: config
91 {{- end}}
92 - mountPath: /etc/localtime
93 name: localtime
94 readOnly: true
95{{- if .Values.persistence.enabled }}
96 - mountPath: /var/lib/mysql
97 name: {{ include "common.fullname" . }}-data
98 subPath: data
99 initContainers:
100 - name: mariadb-galera-prepare
101 image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
102 command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
103 volumeMounts:
104 - name: {{ include "common.fullname" . }}-data
105 mountPath: /var/lib/mysql
106 volumeClaimTemplates:
107 - metadata:
108 name: {{ include "common.fullname" . }}-data
109 annotations:
110 {{- if .Values.persistence.storageClass }}
111 volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
112 {{- else }}
113 volume.alpha.kubernetes.io/storage-class: default
114 {{- end }}
115 spec:
116 accessModes:
117 - {{ .Values.persistence.accessMode | quote }}
118 resources:
119 requests:
120 storage: {{ .Values.persistence.size | quote }}
121{{- end }}