1 {{- if .Values.deployment.kong.enabled }}
2 {{- if .Release.IsInstall -}}
3 {{/* .migrations.init isn't normally exposed in values.yaml, since it should
4 generally always run on install--there should never be any reason to
5 disable it, and at worst it's a no-op. However, https://github.com/helm/helm/issues/3308
6 means we cannot use the default function to create a hidden value, hence
7 the workaround with this $runInit variable.
9 {{- $runInit := true -}}
10 {{- if (hasKey .Values.migrations "init") -}}
11 {{- $runInit = .Values.migrations.init -}}
14 {{- if (and ($runInit) (not (eq .Values.env.database "off"))) }}
18 name: {{ template "kong.fullname" . }}-init-migrations
19 namespace: {{ template "kong.namespace" . }}
21 {{- include "kong.metaLabels" . | nindent 4 }}
22 app.kubernetes.io/component: init-migrations
24 argocd.argoproj.io/hook: Sync
25 argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
26 {{- range $key, $value := .Values.migrations.jobAnnotations }}
27 {{ $key }}: {{ $value | quote }}
30 backoffLimit: {{ .Values.migrations.backoffLimit }}
33 name: {{ template "kong.name" . }}-init-migrations
35 {{- include "kong.metaLabels" . | nindent 8 }}
36 app.kubernetes.io/component: init-migrations
37 {{- if .Values.migrations.annotations }}
39 {{- range $key, $value := .Values.migrations.annotations }}
40 {{ $key }}: {{ $value | quote }}
42 {{- if (and (not .Values.deployment.serviceAccount.automountServiceAccountToken) (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name)) }}
43 kuma.io/service-account-token-volume: {{ template "kong.serviceAccountTokenName" . }}
47 {{- if or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name }}
48 serviceAccountName: {{ template "kong.serviceAccountName" . }}
50 {{- if (and (or .Values.deployment.serviceAccount.create .Values.deployment.serviceAccount.name) .Values.deployment.serviceAccount.automountServiceAccountToken) }}
51 automountServiceAccountToken: true
53 automountServiceAccountToken: false
55 {{- if .Values.image.pullSecrets }}
57 {{- range .Values.image.pullSecrets }}
61 {{- if (or (and (.Values.postgresql.enabled) .Values.waitImage.enabled) .Values.deployment.initContainers) }}
63 {{- if .Values.deployment.initContainers }}
64 {{- toYaml .Values.deployment.initContainers | nindent 6 }}
66 {{- if (and (.Values.postgresql.enabled) .Values.waitImage.enabled) }}
67 {{- include "kong.wait-for-postgres" . | nindent 6 }}
71 {{- if .Values.migrations.sidecarContainers }}
72 {{- toYaml .Values.migrations.sidecarContainers | nindent 6 }}
74 - name: {{ template "kong.name" . }}-migrations
75 image: {{ include "kong.getRepoTag" .Values.image }}
76 imagePullPolicy: {{ .Values.image.pullPolicy }}
78 {{ toYaml .Values.containerSecurityContext | nindent 10 }}
80 {{- include "kong.no_daemon_env" . | nindent 8 }}
81 {{- include "kong.envFrom" .Values.envFrom | nindent 8 }}
82 args: [ "kong", "migrations", "bootstrap" ]
84 {{- include "kong.volumeMounts" . | nindent 8 }}
85 {{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 8 }}
87 {{- toYaml .Values.migrations.resources | nindent 10 }}
89 {{- include "kong.podsecuritycontext" . | nindent 8 }}
90 {{- if .Values.affinity }}
92 {{- toYaml .Values.affinity | nindent 8 }}
94 {{- if .Values.nodeSelector }}
96 {{- toYaml .Values.nodeSelector | nindent 8 }}
98 {{- if .Values.tolerations }}
100 {{- toYaml .Values.tolerations | nindent 8 }}
102 restartPolicy: OnFailure
104 {{- include "kong.volumes" . | nindent 6 -}}
105 {{- include "kong.userDefinedVolumes" . | nindent 6 -}}