diff --git a/charts/invy-chart/templates/db-statefulset.yaml b/charts/invy-chart/templates/db-statefulset.yaml index fa134f4..f38fb09 100644 --- a/charts/invy-chart/templates/db-statefulset.yaml +++ b/charts/invy-chart/templates/db-statefulset.yaml @@ -19,11 +19,26 @@ spec: app.kubernetes.io/component: database spec: securityContext: - runAsUser: 999 - runAsNonRoot: true fsGroup: 999 + initContainers: + - name: fix-permissions + image: busybox:latest + command: + - sh + - -c + - | + chown -R 999:999 /var/lib/postgresql/data + chmod 700 /var/lib/postgresql/data + volumeMounts: + - name: postgres-data + mountPath: /var/lib/postgresql/data + securityContext: + runAsUser: 0 containers: - name: postgres + securityContext: + runAsUser: 999 + runAsNonRoot: true image: "{{ .Values.postgres.image.repository }}:{{ .Values.postgres.image.tag }}" imagePullPolicy: {{ .Values.postgres.image.pullPolicy }} ports: