Updating charts to use common resource template
[oom.git] / kubernetes / common / postgres / templates / statefulset.yaml
index e42e9eb..3c7ae65 100644 (file)
@@ -37,8 +37,13 @@ spec:
         - /bin/sh
         - -c
         - |
-          for i in $(seq 0 $(({{ .Values.replicaCount }}-1))); do mkdir -p /podroot/data$i; done
-          chmod 777 /podroot/*
+          for i in $(seq 0 $(({{ .Values.replicaCount }}-1))); do
+            if [ ! -d /podroot/data$i ]; then
+              mkdir -p /podroot/data$i;
+              chown 26:26 /podroot/data$i;
+              chmod 700 /podroot/data$i;
+            fi;
+          done
         env:
         - name: POD_NAME
           valueFrom: { fieldRef: { fieldPath: metadata.name } }
@@ -111,7 +116,7 @@ spec:
           name: {{ include "common.fullname" . }}-backup
           readOnly: true
         resources:
-{{ toYaml .Values.resources | indent 12 }}
+{{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
         nodeSelector:
 {{ toYaml .Values.nodeSelector | indent 10 }}
@@ -126,7 +131,7 @@ spec:
           path: /etc/localtime
       - name: {{ include "common.fullname" . }}-init
         hostPath:
-          path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Namespace }}/{{ .Values.persistence.mountInitPath }}
+          path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountInitPath }}
       - name: {{ include "common.fullname" . }}-backup
         emptyDir: {}
 #{{ if not .Values.persistence.enabled }}