[UUI] Update image version 16.0.1 of components of UUI
[oom.git] / kubernetes / common / mariadb-galera / templates / statefulset.yaml
index bb3af76..3011d93 100644 (file)
@@ -18,6 +18,7 @@
 # limitations under the License.
 */}}
 
+{{- if not .Values.global.mariadbGalera.useOperator }}
 apiVersion: apps/v1
 kind: StatefulSet
 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
@@ -38,37 +39,24 @@ spec:
       initContainers:
         # we shouldn't need this but for unknown reason, it's fsGroup is not
         # applied
-        - name: fix-permission
+      {{- if .Values.mariadbConfiguration }}
+        - name: copy-config
           command:
             - /bin/sh
           args:
             - -c
             - |
-              chown -R {{ .Values.securityContext.user_id }}:{{ .Values.securityContext.group_id }} /data
-              chown -R {{ .Values.securityContext.user_id }}:{{ .Values.securityContext.group_id }} /bootstrap/
-              chown -R {{ .Values.securityContext.user_id }}:{{ .Values.securityContext.group_id }} /tmp/
-              {{- if .Values.mariadbConfiguration }}
               cp /config/my.cnf /actual/my.cnf
-              chown -R {{ .Values.securityContext.user_id }}:{{ .Values.securityContext.group_id }} /actual
-              {{- end }}
           image: {{ include "repositoryGenerator.image.busybox" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          securityContext:
-            runAsUser: 0
+          {{ include "common.containerSecurityContext" . | indent 10 | trim }}
           volumeMounts:
-            - name: previous-boot
-              mountPath: /bootstrap
-            - name: mariadb-tmp-folder
-              mountPath: /tmp
-            - name: {{ include "common.fullname" . }}
-              mountPath: /data
-            {{- if .Values.mariadbConfiguration }}
             - name: mariadb-galera-starting-config
               mountPath: /config/my.cnf
               subPath: my.cnf
             - name: mariadb-galera-actual-config
               mountPath: /actual
-            {{- end }}
+      {{- end }}
       containers:
         - name: {{ include "common.name" . }}
           image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
@@ -78,7 +66,7 @@ spec:
             - -ec
             - |
                 {{- if (not (empty (.Values.galera.bootstrap.bootstrapFromNode | quote)))}}
-                {{- $fullname := include "common.names.fullname" . }}
+                {{- $fullname := include "common.fullname" . }}
                 {{- $bootstrapFromNode := int .Values.galera.bootstrap.bootstrapFromNode }}
                 # Bootstrap from the indicated node
                 NODE_ID="${MY_POD_NAME#"{{ $fullname }}-"}"
@@ -168,8 +156,11 @@ spec:
             successThreshold: {{ .Values.startupProbe.successThreshold }}
             failureThreshold: {{ .Values.startupProbe.failureThreshold }}
           {{- end }}
+          {{ include "common.containerSecurityContext" . | indent 10 | trim }}
           resources: {{ include "common.resources" . | nindent 12 }}
           volumeMounts:
+            - name: tmp
+              mountPath: /tmp
             - name: previous-boot
               mountPath: /opt/bitnami/mariadb/.bootstrap
             - name: {{ include "common.fullname" . }}
@@ -197,12 +188,12 @@ spec:
             - |
               DATA_SOURCE_NAME="$MARIADB_ROOT_USER:$MARIADB_ROOT_PASSWORD@(localhost:3306)/" /bin/mysqld_exporter $MARIADB_METRICS_EXTRA_FLAGS
           ports:
-            - name: metrics
+            - name: tcp-metrics
               containerPort: 9104
           livenessProbe:
             httpGet:
               path: /metrics
-              port: metrics
+              port: tcp-metrics
             initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
             periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
             timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
@@ -211,17 +202,16 @@ spec:
           readinessProbe:
             httpGet:
               path: /metrics
-              port: metrics
+              port: tcp-metrics
             initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
             periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
             timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
             successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
             failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
-          {{ include "common.containerSecurityContext" . | indent 10 | trim }}
+          securityContext: {{- toYaml .Values.metrics.securityContext | nindent 12 }}
           resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
         {{- end }}
-      imagePullSecrets:
-        - name: {{ include "common.namespace" . }}-docker-registry-key
+      {{- include "common.imagePullSecrets" . | nindent 6 }}
       {{- if .Values.schedulerName }}
       schedulerName: {{ .Values.schedulerName | quote }}
       {{- end }}
@@ -244,13 +234,19 @@ spec:
       tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
       {{- end }}
       volumes:
+        - name: tmp
+          emptyDir:
+            sizeLimit: {{ .Values.volumes.tmpSizeLimit }}
         - name: previous-boot
-          emptyDir: {}
+          emptyDir:
+            sizeLimit: {{ .Values.volumes.bootSizeLimit }}
         - name: mariadb-tmp-folder
-          emptyDir: {}
+          emptyDir:
+            sizeLimit: {{ .Values.volumes.tmpMariaDBSizeLimit }}
         {{- if .Values.mariadbConfiguration  }}
         - name:  mariadb-galera-actual-config
-          emptyDir: {}
+          emptyDir:
+            sizeLimit: {{ .Values.volumes.configSizeLimit }}
         - name: mariadb-galera-starting-config
           configMap:
             name: {{ printf "%s-configuration" (include "common.fullname" .) }}
@@ -266,3 +262,4 @@ spec:
   volumeClaimTemplates:
     - {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }}
 {{- end }}
+{{- end }}