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" . }}-pre-upgrade-migrations
9 {{- include "kong.metaLabels" . | nindent 4 }}
10 app.kubernetes.io/component: pre-upgrade-migrations
12 helm.sh/hook: "pre-upgrade"
13 helm.sh/hook-delete-policy: "before-hook-creation"
17 name: {{ template "kong.name" . }}-pre-upgrade-migrations
19 {{- include "kong.metaLabels" . | nindent 8 }}
20 app.kubernetes.io/component: pre-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" . }}-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 up" ]
43 {{- include "kong.volumeMounts" . | nindent 8 }}
45 {{- include "kong.podsecuritycontext" . | nindent 8 }}
46 restartPolicy: OnFailure
48 {{- include "kong.volumes" . | nindent 6 -}}
51 {{ if or .Values.podSecurityPolicy.enabled (and .Values.ingressController.enabled .Values.ingressController.serviceAccount.create) -}}
56 name: {{ template "kong.serviceAccountName" . }}
57 namespace: {{ .Release.namespace }}
59 "helm.sh/hook": pre-upgrade
60 "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
62 {{- include "kong.metaLabels" . | nindent 4 }}