Merge "Revert "basic auth for so-monitoring""
[oom.git] / kubernetes / common / mariadb-galera / templates / statefulset.yaml
index 5f96ee6..a9f1fb3 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2018 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Orange, Samsung Electronics
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -23,12 +23,15 @@ metadata:
     release: "{{ .Release.Name }}"
     heritage: "{{ .Release.Service }}"
 spec:
-  serviceName: {{ include "common.fullname" . }}
+  serviceName: {{ .Values.service.name }}
   replicas: {{ .Values.replicaCount }}
   template:
     metadata:
       labels:
         app: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
       annotations:
         pod.alpha.kubernetes.io/initialized: "true"
     spec:
@@ -40,7 +43,7 @@ spec:
       {{- if .Values.externalConfig }}
         - name: config
           configMap:
-            name: {{ include "common.fullname" . }}-externalConfig
+            name: {{ include "common.fullname" . }}-external-config
       {{- end}}
         - name: localtime
           hostPath:
@@ -48,7 +51,7 @@ spec:
       imagePullSecrets:
       - name: {{ include "common.namespace" . }}-docker-registry-key
       containers:
-        - name: {{ include "common.fullname" . }}
+        - name: {{ include "common.name" . }}
           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
           env:
@@ -58,34 +61,29 @@ spec:
                   apiVersion: v1
                   fieldPath: metadata.namespace
             - name: MYSQL_USER
-              value: {{ default "" .Values.config.userName | quote }}
+              {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-credentials" "key" "login") | indent 14}}
             - name: MYSQL_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: user-password
+              {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-credentials" "key" "password") | indent 14}}
             - name: MYSQL_DATABASE
               value: {{ default "" .Values.config.mysqlDatabase | quote }}
             - name: MYSQL_ROOT_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: db-root-password
+              {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}}
           ports:
           - containerPort: {{ .Values.service.internalPort }}
-            name: {{ .Values.service.name }}
+            name: {{ .Values.service.portName }}
           - containerPort: {{ .Values.service.sstPort }}
-            name: {{ .Values.service.sstName }}
+            name: {{ .Values.service.sstPortName }}
           - containerPort: {{ .Values.service.replicationPort }}
             name: {{ .Values.service.replicationName }}
           - containerPort: {{ .Values.service.istPort }}
-            name: {{ .Values.service.istName }}
+            name: {{ .Values.service.istPortName }}
           readinessProbe:
             exec:
               command:
               - /usr/share/container-scripts/mysql/readiness-probe.sh
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
+            timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
       {{- if eq .Values.liveness.enabled true }}
           livenessProbe:
             exec:
@@ -95,7 +93,7 @@ spec:
             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
       {{- end }}
           resources:
-{{ toYaml .Values.resources | indent 12 }}
+{{ include "common.resources" . | indent 12 }}
           volumeMounts:
         {{- if .Values.externalConfig }}
           - mountPath: /etc/config
@@ -107,10 +105,10 @@ spec:
 {{- if .Values.persistence.enabled }}
           - mountPath: /var/lib/mysql
             name: {{ include "common.fullname" . }}-data
-            subPath: data
       initContainers:
-        - name: mariadb-galera-prepare
+        - name: {{ include "common.name" . }}-prepare
           image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
           command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
           volumeMounts:
             - name: {{ include "common.fullname" . }}-data
@@ -118,15 +116,15 @@ spec:
   volumeClaimTemplates:
   - metadata:
       name: {{ include "common.fullname" . }}-data
-      annotations:
-  {{- if .Values.persistence.storageClass }}
-        volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
-  {{- else }}
-        volume.alpha.kubernetes.io/storage-class: default
-  {{- end }}
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
     spec:
       accessModes:
       - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
       resources:
         requests:
           storage: {{ .Values.persistence.size | quote }}