-
Notifications
You must be signed in to change notification settings - Fork 1
/
db-initialize-job.yaml
executable file
·40 lines (40 loc) · 1.24 KB
/
db-initialize-job.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{{- if .Values.application.initializeCommand -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "trackableappname" . }}-db-initialize
labels:
app: {{ template "appname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}"
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": before-hook-creation
"helm.sh/hook-weight": "0"
spec:
backoffLimit: 1
template:
metadata:
labels:
app: {{ template "appname" . }}
release: {{ .Release.Name }}
spec:
restartPolicy: Never
imagePullSecrets:
{{ toYaml .Values.image.secrets | indent 10 }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command: ["/bin/sh"]
args: ["-c", "{{ .Values.application.initializeCommand }}"]
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.application.secretName }}
envFrom:
- secretRef:
name: {{ .Values.application.secretName }}
{{- end }}
env:
- name: DATABASE_URL
value: {{ .Values.application.database_url | quote }}
{{- end -}}