diff --git a/charts/dispatch/templates/core-deployment.yaml b/charts/dispatch/templates/core-deployment.yaml index 45645ac..c7f8b7c 100644 --- a/charts/dispatch/templates/core-deployment.yaml +++ b/charts/dispatch/templates/core-deployment.yaml @@ -15,12 +15,6 @@ spec: labels: app: {{ include "dispatch.fullname" . }}-core spec: - initContainers: - - name: db-init - image: "{{ .Values.initContainers.dbInit.image.registry }}:{{ .Values.initContainers.dbInit.image.tag }}" - envFrom: - - secretRef: - name: {{ .Values.postgres.secretName }} {{ if ne .Values.image.pullSecret "" }} imagePullSecrets: - name: "{{ .Values.image.pullSecret }}" diff --git a/charts/dispatch/templates/dispatch-db-init.yaml b/charts/dispatch/templates/dispatch-db-init.yaml index 16ca6de..a13e811 100644 --- a/charts/dispatch/templates/dispatch-db-init.yaml +++ b/charts/dispatch/templates/dispatch-db-init.yaml @@ -26,7 +26,37 @@ spec: image: "{{ coalesce $.Values.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}" imagePullPolicy: {{ coalesce $.Values.image.pullPolicy .pullPolicy }} {{- end }} - command: ["dispatch", "database", "init"] + command: + - /bin/sh + - -c + - | + dispatch database init || true + env: &dispatchEnv + - name: MJML_PATH + value: /node_modules/.bin + - name: DISPATCH_UI_URL + value: "{{ .Values.url }}" + - name: DATABASE_HOSTNAME + value: "{{ .Values.postgres.hostname }}" + - name: DATABASE_PORT + value: "{{ .Values.postgres.port }}" + - name: DATABASE_NAME + value: "{{ .Values.postgres.database_name }}" + {{ if eq .Values.authentication.provider_slug "dispatch-auth-provider-header" }} + - name: DISPATCH_AUTHENTICATION_PROVIDER_SLUG + value: "{{ .Values.authentication.provider_slug }}" + - name: DISPATCH_AUTHENTICATION_PROVIDER_HEADER_NAME + value: "{{ .Values.authentication.header.header_name }}" + {{ end }} + envFrom: + - secretRef: + name: {{ .Values.envFromSecret }} + - name: dispatch-db-upgrade + {{- with .Values.image }} + image: "{{ coalesce $.Values.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}" + imagePullPolicy: {{ coalesce $.Values.image.pullPolicy .pullPolicy }} + {{- end }} + command: ["dispatch", "database", "upgrade"] env: &dispatchEnv - name: MJML_PATH value: /node_modules/.bin