Skip to content

Commit c65efeb

Browse files
committed
Add an init container to do the upgrade
Signed-off-by: Remi Rampin <remi@rampin.org>
1 parent f9830df commit c65efeb

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

charts/nextcloud/templates/deployment.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ spec:
266266
nodeSelector:
267267
{{- toYaml . | nindent 8 }}
268268
{{- end }}
269-
{{- if or .Values.nextcloud.extraInitContainers .Values.mariadb.enabled .Values.postgresql.enabled }}
270269
initContainers:
271270
{{- if .Values.nextcloud.extraInitContainers }}
272271
{{- toYaml .Values.nextcloud.extraInitContainers | nindent 6 }}
@@ -305,7 +304,27 @@ spec:
305304
- "-c"
306305
- "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done"
307306
{{- end }}
308-
{{- end }}
307+
- name: {{ .Chart.Name }}-upgrade
308+
image: {{ include "nextcloud.image" . }}
309+
imagePullPolicy: {{ .Values.image.pullPolicy }}
310+
args:
311+
# Do upgrade and then exit
312+
# This avoids doing it in the container, which could get killed by failed liveness probes
313+
- "true"
314+
env:
315+
- name: NEXTCLOUD_UPDATE
316+
value: "1"
317+
{{- include "nextcloud.env" . | indent 8 }}
318+
resources:
319+
{{ toYaml .Values.resources | indent 10 }}
320+
{{- if .Values.nextcloud.securityContext}}
321+
securityContext:
322+
{{- with .Values.nextcloud.securityContext }}
323+
{{- toYaml . | nindent 10 }}
324+
{{- end }}
325+
{{- end }}
326+
volumeMounts:
327+
{{- include "nextcloud.volumeMounts" . | trim | nindent 8 }}
309328
{{- with .Values.affinity }}
310329
affinity:
311330
{{- toYaml . | nindent 8 }}

0 commit comments

Comments
 (0)