1 {{- if .Values.deployment.kong.enabled }}
2 {{- if (and .Values.migrations.preUpgrade (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" . }}-pre-upgrade-migrations
9 namespace: {{ template "kong.namespace" . }}
11 {{- include "kong.metaLabels" . | nindent 4 }}
12 app.kubernetes.io/component: pre-upgrade-migrations
14 helm.sh/hook: "pre-upgrade"
15 helm.sh/hook-delete-policy: "before-hook-creation"
16 argocd.argoproj.io/hook: Sync
17 argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
18 {{- range $key, $value := .Values.migrations.jobAnnotations }}
19 {{ $key }}: {{ $value | quote }}
22 backoffLimit: {{ .Values.migrations.backoffLimit }}
25 name: {{ template "kong.name" . }}-pre-upgrade-migrations
27 {{- include "kong.metaLabels" . | nindent 8 }}
28 app.kubernetes.io/component: pre-upgrade-migrations
29 {{- if .Values.migrations.annotations }}
31 {{- range $key, $value := .Values.migrations.annotations }}
32 {{ $key }}: {{ $value | quote }}
34 {{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
35 kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
39 {{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
40 serviceAccountName: {{ template "kong.serviceAccountName" . }}
42 {{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
43 automountServiceAccountToken: true
45 automountServiceAccountToken: false
47 {{- if .Values.image.pullSecrets }}
49 {{- range .Values.image.pullSecrets }}
53 {{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
55 {{- if .Values.deployment.initContainers }}
56 {{- toYaml .Values.deployment.initContainers | nindent 6 }}
58 {{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
59 {{- include "kong.wait-for-postgres" . | nindent 6 }}
63 {{- if .Values.migrations.sidecarContainers }}
64 {{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
66 - name: {{ template "kong.name" . }}-upgrade-migrations
67 image: {{ include "kong.getRepoTag" .Values.image }}
68 imagePullPolicy: {{ .Values.image.pullPolicy }}
70 {{ toYaml .Values.containerSecurityContext | nindent 10 }}
72 {{- include "kong.no_daemon_env" . | nindent 8 }}
73 {{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
74 args: [ "kong", "migrations", "up" ]
76 {{- include "kong.volumeMounts" . | nindent 8 }}
77 {{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
79 {{- toYaml .Values.migrations.resources| nindent 10 }}
81 {{- include "kong.podsecuritycontext" . | nindent 8 }}
82 {{- if .Values.affinity }}
84 {{- toYaml .Values.affinity | nindent 8 }}
86 {{- if .Values.nodeSelector }}
88 {{- toYaml .Values.nodeSelector | nindent 8 }}
90 {{- if .Values.tolerations }}
92 {{- toYaml .Values.tolerations | nindent 8 }}
94 restartPolicy: OnFailure
96 {{- include "kong.volumes" . | nindent 6 -}}
97 {{- include "kong.userDefinedVolumes" . | nindent 6 -}}