/
datahub-cleanup-job-template.yml
96 lines (96 loc) · 4 KB
/
datahub-cleanup-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
{{- if .Values.datahubUpgrade.enabled -}}
# Job template for running datahub cleanup
# 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-cleanup-job-template datahub-cleanup-job
apiVersion: {{ include "datahub.cronjob.apiVersion" $}}
kind: CronJob
metadata:
name: {{ .Release.Name }}-datahub-cleanup-job-template
labels:
{{- include "datahub.labels" . | nindent 4 }}
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.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", "NoCodeDataMigrationCleanup" ]
env:
{{- include "datahub.upgrade.env" . | nindent 16}}
{{- if .Values.global.datahub.metadata_service_authentication.enabled }}
- name: DATAHUB_SYSTEM_CLIENT_ID
value: {{ .Values.global.datahub.metadata_service_authentication.systemClientId }}
- name: DATAHUB_SYSTEM_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretRef }}
key: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretKey }}
{{- end }}
{{- with .Values.datahubUpgrade.extraEnvs }}
{{- toYaml . | nindent 16 }}
{{- end }}
securityContext:
{{- toYaml .Values.datahubUpgrade.securityContext | nindent 16 }}
volumeMounts:
{{- with .Values.datahubUpgrade.extraVolumeMounts }}
{{- toYaml . | nindent 16 }}
{{- end }}
resources:
{{- toYaml .Values.datahubUpgrade.cleanupJob.resources | nindent 16 }}
{{- with .Values.datahubUpgrade.cleanupJob.extraSidecars }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- 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 -}}