From b341cc8e9c1436b45756021da277ce79619c87c8 Mon Sep 17 00:00:00 2001 From: portdirect Date: Wed, 17 Jan 2018 09:48:31 -0500 Subject: [PATCH] Mariadb: enable storage ownership management on pod start This PS enables storage ownership management on pod start, which is required for some PVC providers/provisioners. Change-Id: Idb4bd20104815efb241ed163daddf27f8bd2b559 --- mariadb/templates/statefulset.yaml | 16 ++++++++++++++++ mariadb/values.yaml | 1 + 2 files changed, 17 insertions(+) diff --git a/mariadb/templates/statefulset.yaml b/mariadb/templates/statefulset.yaml index 0210c3fbcd..472279563a 100644 --- a/mariadb/templates/statefulset.yaml +++ b/mariadb/templates/statefulset.yaml @@ -40,6 +40,22 @@ spec: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} initContainers: {{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} +{{- if .Values.volume.chown_on_start }} + - name: mariadb-perms + image: {{ .Values.images.tags.mariadb }} + imagePullPolicy: {{ .Values.images.pull_policy }} + securityContext: + runAsUser: 0 +{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} + command: + - chown + - -R + - "mysql:mysql" + - /var/lib/mysql + volumeMounts: + - name: mysql-data + mountPath: /var/lib/mysql +{{- end }} containers: - name: mariadb image: {{ .Values.images.tags.mariadb }} diff --git a/mariadb/values.yaml b/mariadb/values.yaml index 896032e932..429e09b3f3 100644 --- a/mariadb/values.yaml +++ b/mariadb/values.yaml @@ -53,6 +53,7 @@ dependencies: force_bootstrap: false volume: + chown_on_start: true enabled: true class_name: general size: 5Gi