-
Notifications
You must be signed in to change notification settings - Fork 251
/
Copy pathdatahub-restore-indices-job-template.yml
121 lines (121 loc) · 5.32 KB
/
datahub-restore-indices-job-template.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{{- if .Values.datahubUpgrade.enabled -}}
# Job template for restoring indices by sending MAE corresponding to all entities in the local db
# Creates a suspended cronJob that you can use to create an adhoc job when ready to run clean up.
# Run the following command to do so
# kubectl create job --from=cronjob/<<release-name>>-datahub-restore-indices-job-template datahub-restore-indices-job
apiVersion: {{ include "datahub.cronjob.apiVersion" $}}
kind: CronJob
metadata:
name: {{ .Release.Name }}-datahub-restore-indices-job-template
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
spec:
schedule: "* * * * *"
suspend: true
jobTemplate:
spec:
template:
{{- if or .Values.global.podLabels .Values.datahubUpgrade.podAnnotations }}
metadata:
{{- with .Values.datahubUpgrade.podAnnotations }}
annotations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.global.podLabels }}
labels:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- end }}
spec:
{{- with .Values.global.hostAliases }}
hostAliases:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.datahubUpgrade.serviceAccount }}
serviceAccountName: {{ . }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- with .Values.global.credentialsAndCertsSecrets }}
- name: datahub-certs-dir
secret:
defaultMode: 0444
secretName: {{ .name }}
{{- end }}
{{- with .Values.datahubUpgrade.extraVolumes }}
{{- toYaml . | nindent 12 }}
{{- end }}
restartPolicy: Never
securityContext:
{{- toYaml .Values.datahubUpgrade.podSecurityContext | nindent 12 }}
initContainers:
{{- with .Values.datahubUpgrade.extraInitContainers }}
{{- toYaml . | nindent 12 }}
{{- end }}
containers:
- name: datahub-upgrade-job
image: "{{ .Values.datahubUpgrade.image.repository }}:{{ required "Global or specific tag is required" (.Values.datahubUpgrade.image.tag | default .Values.global.datahub.version) }}"
imagePullPolicy: {{ .Values.datahubUpgrade.image.pullPolicy | default "IfNotPresent" }}
args:
- "-u"
- "RestoreIndices"
- "-a"
- "batchSize={{ .Values.datahubUpgrade.batchSize }}"
- "-a"
- "batchDelayMs={{ .Values.datahubUpgrade.batchDelayMs }}"
env:
- name: EBEAN_DATASOURCE_USERNAME
value: {{ (.Values.sql).datasource.username | default .Values.global.sql.datasource.username | quote }}
- name: EBEAN_DATASOURCE_PASSWORD
{{- $passwordValue := (.Values.sql).datasource.password.value | default .Values.global.sql.datasource.password.value }}
{{- if $passwordValue }}
value: {{ $passwordValue | quote }}
{{- else }}
valueFrom:
secretKeyRef:
name: "{{ (.Values.sql).datasource.password.secretRef | default .Values.global.sql.datasource.password.secretRef }}"
key: "{{ (.Values.sql).datasource.password.secretKey | default .Values.global.sql.datasource.password.secretKey }}"
{{- end }}
- name: EBEAN_DATASOURCE_HOST
value: "{{ .Values.global.sql.datasource.host }}"
- name: EBEAN_DATASOURCE_URL
value: "{{ .Values.global.sql.datasource.url }}"
- name: EBEAN_DATASOURCE_DRIVER
value: "{{ .Values.global.sql.datasource.driver }}"
{{- include "datahub.upgrade.env" . | nindent 16}}
{{- with .Values.datahubUpgrade.extraEnvs }}
{{- toYaml . | nindent 16 }}
{{- end }}
securityContext:
{{- toYaml .Values.datahubUpgrade.securityContext | nindent 16 }}
volumeMounts:
{{- with .Values.global.credentialsAndCertsSecrets }}
- name: datahub-certs-dir
mountPath: {{ .path | default "/mnt/certs" }}
{{- end }}
{{- with .Values.datahubUpgrade.extraVolumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
resources:
{{- toYaml .Values.datahubUpgrade.restoreIndices.resources | nindent 16}}
{{- with .Values.datahubUpgrade.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.datahubUpgrade.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.datahubUpgrade.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end -}}