From c65efeb5e67e7b443c6457ac563b14cf3c6bfc79 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Fri, 27 Jan 2023 11:38:07 -0500 Subject: [PATCH] Add an init container to do the upgrade Signed-off-by: Remi Rampin --- charts/nextcloud/templates/deployment.yaml | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 7d0798c0..e694236f 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -266,7 +266,6 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- if or .Values.nextcloud.extraInitContainers .Values.mariadb.enabled .Values.postgresql.enabled }} initContainers: {{- if .Values.nextcloud.extraInitContainers }} {{- toYaml .Values.nextcloud.extraInitContainers | nindent 6 }} @@ -305,7 +304,27 @@ spec: - "-c" - "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done" {{- end }} - {{- end }} + - name: {{ .Chart.Name }}-upgrade + image: {{ include "nextcloud.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + # Do upgrade and then exit + # This avoids doing it in the container, which could get killed by failed liveness probes + - "true" + env: + - name: NEXTCLOUD_UPDATE + value: "1" +{{- include "nextcloud.env" . | indent 8 }} + resources: +{{ toYaml .Values.resources | indent 10 }} + {{- if .Values.nextcloud.securityContext}} + securityContext: + {{- with .Values.nextcloud.securityContext }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + volumeMounts: + {{- include "nextcloud.volumeMounts" . | trim | nindent 8 }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }}