SMO NONRTRIC - Fix service manager preload
[it/dep.git] / templates / migrations-post-upgrade.yaml
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
4 apiVersion: batch/v1
5 kind: Job
6 metadata:
7   name: {{ template "kong.fullname" . }}-post-upgrade-migrations
8   labels:
9     {{- include "kong.metaLabels" . | nindent 4 }}
10     app.kubernetes.io/component: post-upgrade-migrations
11   annotations:
12     helm.sh/hook: "post-upgrade"
13     helm.sh/hook-delete-policy: "before-hook-creation"
14 spec:
15   template:
16     metadata:
17       name: {{ template "kong.name" . }}-post-upgrade-migrations
18       labels:
19         {{- include "kong.metaLabels" . | nindent 8 }}
20         app.kubernetes.io/component: post-upgrade-migrations
21     spec:
22       {{- if .Values.podSecurityPolicy.enabled }}
23       serviceAccountName: {{ template "kong.serviceAccountName" . }}
24       {{- end }}
25       {{- if .Values.image.pullSecrets }}
26       imagePullSecrets:
27       {{- range .Values.image.pullSecrets }}
28         - name: {{ . }}
29       {{- end }}
30       {{- end }}
31       initContainers:
32       {{- if (eq .Values.env.database "postgres") }}
33       {{- include "kong.wait-for-postgres" . | nindent 6 }}
34       {{- end }}
35       containers:
36       - name: {{ template "kong.name" . }}-post-upgrade-migrations
37         image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
38         imagePullPolicy: {{ .Values.image.pullPolicy }}
39         env:
40         {{- include "kong.final_env" . | nindent 8 }}
41         command: [ "/bin/sh", "-c", "kong migrations finish" ]
42         volumeMounts:
43         {{- include "kong.volumeMounts" . | nindent 8 }}
44       securityContext:
45       {{- include "kong.podsecuritycontext" . | nindent 8 }}
46       restartPolicy: OnFailure
47       volumes:
48       {{- include "kong.volumes" . | nindent 6 -}}
49 {{- end }}