[stable/postgresql] excluding ".snapshot" in chown during init (#13754)

* excluding ".snapshot" in chown during init

  in some environment, where PVs are NFS volumes with `.shapshot` directories,
  such as the case with NetApps, `chown -R` would fail during execution of
  initContainer command
  to avoid failure, `.snapshot` shouldbe excluded from `chown -R`

Signed-off-by: Anastas Dancha <anapsix@random.io>

* same in less lines

Signed-off-by: Anastas Dancha <anapsix@random.io>

* using find statement w/ xargs for error handling

Signed-off-by: Anastas Dancha <anapsix@random.io>
This commit is contained in:
Anastas Dancha
2019-05-15 09:00:43 -07:00
committed by Kubernetes Prow Robot
parent 0fe1c774cc
commit 15ec005a8b
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: postgresql
version: 4.2.0
version: 4.2.1
appVersion: 10.8.0
description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
@@ -67,7 +67,8 @@ spec:
- sh
- -c
- |
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /bitnami
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" | \
xargs chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
if [ -d {{ .Values.persistence.mountPath }}/data ]; then
chmod 0700 {{ .Values.persistence.mountPath }}/data;
fi
+4 -3
View File
@@ -55,7 +55,7 @@ spec:
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
fsGroup: {{ .Values.securityContext.fsGroup }}
{{- end }}
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ default (include "postgresql.fullname" . ) .Values.serviceAccount.name }}
@@ -71,7 +71,8 @@ spec:
- sh
- -c
- |
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /bitnami
find {{ .Values.persistence.mountPath }} -mindepth 1 -maxdepth 1 -not -name ".snapshot" | \
xargs chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}
if [ -d {{ .Values.persistence.mountPath }}/data ]; then
chmod 0700 {{ .Values.persistence.mountPath }}/data;
fi
@@ -220,7 +221,7 @@ spec:
{{- if .Values.metrics.securityContext.enabled }}
securityContext:
runAsUser: {{ .Values.metrics.securityContext.runAsUser }}
{{- end }}
{{- end }}
env:
{{- $database := required "In order to enable metrics you need to specify a database (.Values.postgresqlDatabase or .Values.global.postgresql.postgresqlDatabase)" (include "postgresql.database" .) }}
- name: DATA_SOURCE_URI