1
+ {{- if .Values.setupJob.enabled }}
2
+ # create a role and rolebinding to write to the configmap
3
+ apiVersion : rbac.authorization.k8s.io/v1
4
+ kind : Role
5
+ metadata :
6
+ name : hatchet-config-writer
7
+ labels :
8
+ {{- include "hatchet.labels" . | nindent 4 }}
9
+ rules :
10
+ - apiGroups : [""]
11
+ resources : ["configmaps", "secrets"]
12
+ verbs : ["get", "create", "update", "patch", "delete"]
13
+ ---
14
+ apiVersion : rbac.authorization.k8s.io/v1
15
+ kind : RoleBinding
16
+ metadata :
17
+ name : hatchet-config-writer
18
+ labels :
19
+ {{- include "hatchet.labels" . | nindent 4 }}
20
+ roleRef :
21
+ apiGroup : rbac.authorization.k8s.io
22
+ kind : Role
23
+ name : hatchet-config-writer
24
+ subjects :
25
+ - kind : ServiceAccount
26
+ name : {{ template "hatchet.serviceAccountName" . }}
27
+ namespace : {{ .Release.Namespace }}
28
+ ---
29
+ apiVersion : batch/v1
30
+ kind : Job
31
+ metadata :
32
+ name : " {{ .Release.Name | trunc 20 }}-{{ randAlphaNum 10 | lower }}"
33
+ labels :
34
+ {{- include "hatchet.labels" . | nindent 4 }}
35
+ spec :
36
+ backoffLimit : 1
37
+ activeDeadlineSeconds : 300
38
+ template :
39
+ metadata :
40
+ name : {{ template "hatchet.fullname" . }}-migration
41
+ labels :
42
+ {{- include "hatchet.labels" . | nindent 8 }}
43
+ spec :
44
+ restartPolicy : Never
45
+ shareProcessNamespace : true
46
+ serviceAccountName : {{ template "hatchet.serviceAccountName" . }}
47
+ {{- if .Values.priorityClassName }}
48
+ priorityClassName : " {{ .Values.priorityClassName }}"
49
+ {{- end }}
50
+ initContainers :
51
+ # Run migrations as an init container
52
+ {{- if .Values.migrationJob.enabled }}
53
+ - name : migration-job
54
+ image : " {{ .Values.migrationJob.image.repository }}:{{ required " Please set a value for .Values.image.tag" .Values.migrationJob.image.tag }}"
55
+ imagePullPolicy : Always
56
+ command : ["/bin/sh", "-c"]
57
+ args :
58
+ - ./atlas-apply.sh
59
+ securityContext :
60
+ capabilities :
61
+ add :
62
+ - SYS_PTRACE
63
+ env :
64
+ {{- range $key, $value := .Values.env }}
65
+ - name : " {{ $key }}"
66
+ value : " {{ $value }}"
67
+ {{- end }}
68
+ envFrom :
69
+ {{ toYaml .Values.envFrom | indent 10 }}
70
+ {{- end }}
71
+ {{- if .Values.seedJob.enabled }}
72
+ - name : seed-job
73
+ image : " {{ .Values.setupJob.image.repository }}:{{ required " Please set a value for .Values.image.tag" .Values.setupJob.image.tag }}"
74
+ imagePullPolicy : Always
75
+ # this command requires read-write access on the hatchet-config configmap
76
+ command : ["/hatchet/hatchet-admin", "quickstart", "--skip", "certs", "--skip", "keys"]
77
+ securityContext :
78
+ capabilities :
79
+ add :
80
+ - SYS_PTRACE
81
+ env :
82
+ {{- range $key, $value := .Values.env }}
83
+ - name : " {{ $key }}"
84
+ value : " {{ $value }}"
85
+ {{- end }}
86
+ envFrom :
87
+ {{ toYaml .Values.envFrom | indent 10 }}
88
+ {{- end }}
89
+ {{- if and (not .Values.migrationJob.enabled) (not .Values.seedJob.enabled) }}
90
+ []
91
+ {{- end }}
92
+ containers :
93
+ - name : setup-job
94
+ image : " {{ .Values.setupJob.image.repository }}:{{ required " Please set a value for .Values.image.tag" .Values.setupJob.image.tag }}"
95
+ imagePullPolicy : Always
96
+ # this command requires read-write access on the hatchet-config configmap
97
+ command : ["/hatchet/hatchet-admin", "k8s", "quickstart", "--namespace", "{{ .Release.Namespace }}"]
98
+ securityContext :
99
+ capabilities :
100
+ add :
101
+ - SYS_PTRACE
102
+ env :
103
+ {{- range $key, $value := .Values.env }}
104
+ - name : " {{ $key }}"
105
+ value : " {{ $value }}"
106
+ {{- end }}
107
+ envFrom :
108
+ {{ toYaml .Values.envFrom | indent 10 }}
109
+ - name : setup-worker-token
110
+ image : " {{ .Values.setupJob.image.repository }}:{{ required " Please set a value for .Values.image.tag" .Values.setupJob.image.tag }}"
111
+ imagePullPolicy : Always
112
+ # this command requires read-write access on the hatchet-config configmap
113
+ command : ["/hatchet/hatchet-admin", "k8s", "create-worker-token", "--namespace", "{{ .Release.Namespace }}"]
114
+ securityContext :
115
+ capabilities :
116
+ add :
117
+ - SYS_PTRACE
118
+ env :
119
+ {{- range $key, $value := .Values.env }}
120
+ - name : " {{ $key }}"
121
+ value : " {{ $value }}"
122
+ {{- end }}
123
+ envFrom :
124
+ {{ toYaml .Values.deploymentEnvFrom | nindent 10 }}
125
+ {{- if .Values.envFrom }}
126
+ {{ toYaml .Values.envFrom | nindent 10 }}
127
+ {{- end }}
128
+ {{- with .Values.extraContainers }}
129
+ {{ toYaml . | indent 8 }}
130
+ {{- end }}
131
+ {{- end }}
0 commit comments