1 {{- if .Values.deployment.kong.enabled }}
2 {{- if (and .Values.migrations.postUpgrade (not (eq .Values.env.database "off"))) }}
3 # Why is this Job duplicated and not using only helm hooks?
4 # See: https://github.com/helm/charts/pull/7362
8 name: {{ template "kong.fullname" . }}-post-upgrade-migrations
9 namespace: {{ template "kong.namespace" . }}
11 {{- include "kong.metaLabels" . | nindent 4 }}
12 app.kubernetes.io/component: post-upgrade-migrations
14 helm.sh/hook: "post-upgrade"
15 helm.sh/hook-delete-policy: "before-hook-creation"
16 {{- range $key, $value := .Values.migrations.jobAnnotations }}
17 {{ $key }}: {{ $value | quote }}
20 backoffLimit: {{ .Values.migrations.backoffLimit }}
23 name: {{ template "kong.name" . }}-post-upgrade-migrations
25 {{- include "kong.metaLabels" . | nindent 8 }}
26 app.kubernetes.io/component: post-upgrade-migrations
27 {{- if .Values.migrations.annotations }}
29 {{- range $key, $value := .Values.migrations.annotations }}
30 {{ $key }}: {{ $value | quote }}
32 {{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
33 kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
37 {{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
38 serviceAccountName: {{ template "kong.serviceAccountName" . }}
40 {{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
41 automountServiceAccountToken: true
43 automountServiceAccountToken: false
45 {{- if .Values.image.pullSecrets }}
47 {{- range .Values.image.pullSecrets }}
51 {{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
53 {{- if .Values.deployment.initContainers }}
54 {{- toYaml .Values.deployment.initContainers | nindent 6 }}
56 {{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
57 {{- include "kong.wait-for-postgres" . | nindent 6 }}
61 {{- if .Values.migrations.sidecarContainers }}
62 {{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
64 - name: {{ template "kong.name" . }}-post-upgrade-migrations
65 image: {{ include "kong.getRepoTag" .Values.image }}
66 imagePullPolicy: {{ .Values.image.pullPolicy }}
68 {{ toYaml .Values.containerSecurityContext | nindent 10 }}
70 {{- include "kong.no_daemon_env" . | nindent 8 }}
71 {{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
72 args: [ "kong", "migrations", "finish" ]
74 {{- include "kong.volumeMounts" . | nindent 8 }}
75 {{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
77 {{- toYaml .Values.migrations.resources | nindent 10 }}
79 {{- include "kong.podsecuritycontext" . | nindent 8 }}
80 {{- if .Values.affinity }}
82 {{- toYaml .Values.affinity | nindent 8 }}
84 {{- if .Values.nodeSelector }}
86 {{- toYaml .Values.nodeSelector | nindent 8 }}
88 {{- if .Values.tolerations }}
90 {{- toYaml .Values.tolerations | nindent 8 }}
92 restartPolicy: OnFailure
94 {{- include "kong.volumes" . | nindent 6 -}}
95 {{- include "kong.userDefinedVolumes" . | nindent 6 -}}