{{/*
-# Copyright © 2018 Amdocs, Bell Canada
+# Copyright © 2018 Amdocs
+# Copyright © 2018,2021 Bell Canada
# Copyright © 2019 Samsung Electronics
# Copyright © 2019-2020 Orange
# Copyright © 2020 Bitnami
# limitations under the License.
*/}}
+{{- if not .Values.global.mariadbGalera.useOperator }}
apiVersion: apps/v1
kind: StatefulSet
metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
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 }}
- -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 }}-"}"
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" . }}
- |
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
- initialDelaySeconds: 30
- timeoutSeconds: 5
+ port: tcp-metrics
+ initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
+ periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
+ timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
+ successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
+ failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
readinessProbe:
httpGet:
path: /metrics
- port: metrics
- initialDelaySeconds: 5
- timeoutSeconds: 1
- {{ include "common.containerSecurityContext" . | indent 10 | trim }}
+ 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 }}
+ 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 }}
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" .) }}
volumeClaimTemplates:
- {{ include "common.PVCTemplate" (dict "dot" . "suffix" "data" "persistenceInfos" .Values.persistence) | indent 6 | trim }}
{{- end }}
+{{- end }}