diff --git a/charts/owncloud/templates/deployment.yaml b/charts/owncloud/templates/deployment.yaml index 801ca89..8bc238e 100644 --- a/charts/owncloud/templates/deployment.yaml +++ b/charts/owncloud/templates/deployment.yaml @@ -33,14 +33,24 @@ spec: securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: - - name: "init-{{ .Chart.Name }}" + - name: "init-{{ .Chart.Name }}-mkdir" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - command: ['sh', '-c', "mkdir -p {{ .Values.owncloud.volume.apps }} {{ .Values.owncloud.volume.config }} {{ .Values.owncloud.volume.files }} {{ .Values.owncloud.volume.sessions }}; chown -R www-data:www-data {{ .Values.owncloud.volume.root }}"] + command: ['sh', '-c', "mkdir -p {{ .Values.owncloud.volume.apps }} {{ .Values.owncloud.volume.config }} {{ .Values.owncloud.volume.files }} {{ .Values.owncloud.volume.sessions }}"] volumeMounts: - name: owncloud-data mountPath: {{ .Values.owncloud.volume.root }} resources: {{- toYaml .Values.initResources | nindent 12 }} + {{- if not .Values.skipChown }} + - name: "init-{{ .Chart.Name }}-chown" + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + command: ['sh', '-c', "chown -R www-data:www-data {{ .Values.owncloud.volume.root }}"] + volumeMounts: + - name: owncloud-data + mountPath: {{ .Values.owncloud.volume.root }} + resources: + {{- toYaml .Values.initResources | nindent 12 }} + {{- end }} containers: - name: {{ .Chart.Name }}