1 {{- if (and (.Values.runMigrations) (not (eq .Values.env.database "off"))) }}
2 # Why is this Job duplicated and not using only helm hooks?
3 # See: https://github.com/helm/charts/pull/7362
7 name: {{ template "kong.fullname" . }}-post-upgrade-migrations
9 {{- include "kong.metaLabels" . | nindent 4 }}
10 app.kubernetes.io/component: post-upgrade-migrations
12 helm.sh/hook: "post-upgrade"
13 helm.sh/hook-delete-policy: "before-hook-creation"
17 name: {{ template "kong.name" . }}-post-upgrade-migrations
19 {{- include "kong.metaLabels" . | nindent 8 }}
20 app.kubernetes.io/component: post-upgrade-migrations
22 {{- if .Values.podSecurityPolicy.enabled }}
23 serviceAccountName: {{ template "kong.serviceAccountName" . }}
25 {{- if .Values.image.pullSecrets }}
27 {{- range .Values.image.pullSecrets }}
32 {{- if (eq .Values.env.database "postgres") }}
33 {{- include "kong.wait-for-postgres" . | nindent 6 }}
36 - name: {{ template "kong.name" . }}-post-upgrade-migrations
37 image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
38 imagePullPolicy: {{ .Values.image.pullPolicy }}
40 {{- include "kong.final_env" . | nindent 8 }}
41 command: [ "/bin/sh", "-c", "kong migrations finish" ]
43 {{- include "kong.volumeMounts" . | nindent 8 }}
45 {{- include "kong.podsecuritycontext" . | nindent 8 }}
46 restartPolicy: OnFailure
48 {{- include "kong.volumes" . | nindent 6 -}}