1
- {{- range list "server" "worker" }}
1
+ {{- range $component := list "server" "worker" }}
2
2
---
3
3
apiVersion : apps/v1
4
4
kind : Deployment
5
5
metadata :
6
6
name : {{ printf "%s-%s" (include "common.names.fullname" $) . }}
7
7
labels :
8
8
{{- include "common.labels" $ | nindent 4 }}
9
- app.kubernetes.io/component : " {{ . }}"
9
+ app.kubernetes.io/component : " {{ $component }}"
10
10
spec :
11
- {{ if eq . "server" - }}
11
+ {{- if eq . "server" }}
12
12
replicas : {{ $.Values.replicas }}
13
- {{- else - }}
13
+ {{- else }}
14
14
replicas : {{ $.Values.worker.replicas }}
15
15
{{- end }}
16
16
selector :
17
17
matchLabels :
18
18
{{- include "common.labels.selectorLabels" $ | nindent 6 }}
19
- app.kubernetes.io/component : " {{ . }}"
19
+ app.kubernetes.io/component : " {{ $component }}"
20
20
template :
21
21
metadata :
22
22
labels :
23
23
{{- include "common.labels.selectorLabels" $ | nindent 8 }}
24
- app.kubernetes.io/component : " {{ . }}"
24
+ app.kubernetes.io/component : " {{ $component }}"
25
25
app.kubernetes.io/version : " {{ $.Values.image.tag }}"
26
- {{- if $.Values.podAnnotations }}
26
+ {{- with $.Values.podAnnotations }}
27
27
annotations :
28
- {{- toYaml $.Values.podAnnotations | nindent 8 }}
28
+ {{- toYaml . | nindent 8 }}
29
29
{{- end }}
30
30
spec :
31
- {{- if $.Values.image.pullSecrets }}
31
+ {{- with $.Values.image.pullSecrets }}
32
32
imagePullSecrets :
33
- {{- toYaml $.Values.image.pullSecrets | nindent 8 }}
33
+ {{- toYaml . | nindent 8 }}
34
34
{{- end }}
35
35
{{- if $.Values.serviceAccount.create }}
36
36
serviceAccountName : {{ include "common.names.fullname" $ }}
@@ -60,20 +60,25 @@ spec:
60
60
{{- end }}
61
61
{{- tpl (toYaml $initContainers) $ | nindent 8 }}
62
62
{{- end }}
63
- {{ if eq . "server" - }}
63
+ {{- if eq $component "server" }}
64
64
priorityClassName : {{ $.Values.priorityClassName }}
65
+ {{- with $.Values.securityContext }}
65
66
securityContext :
66
- {{- toYaml $.Values.securityContext | nindent 8 }}
67
- {{- else -}}
67
+ {{- toYaml . | nindent 8 }}
68
+ {{- end }}
69
+ {{- else }}
68
70
priorityClassName : {{ $.Values.worker.priorityClassName }}
71
+ {{- with $.Values.worker.securityContext }}
69
72
securityContext :
70
- {{- toYaml $.Values.worker.securityContext | nindent 8 }}
73
+ {{- toYaml . | nindent 8 }}
74
+ {{- end }}
71
75
{{- end }}
72
76
containers :
73
77
- name : {{ $.Chart.Name }}
74
78
image : " {{ $.Values.image.repository }}:{{ $.Values.image.tag }}{{- if $.Values.image.digest -}}@{{ $.Values.image.digest }}{{- end -}}"
75
79
imagePullPolicy : " {{ $.Values.image.pullPolicy }}"
76
- args : [{{ quote . }}]
80
+ args :
81
+ - {{ $component | quote }}
77
82
env :
78
83
{{- range $k, $v := $.Values.env }}
79
84
- name : {{ quote $k }}
@@ -85,31 +90,33 @@ spec:
85
90
valueFrom :
86
91
{{- toYaml $val | nindent 16 }}
87
92
{{- end }}
88
- {{- with $.Values.envFrom }}
93
+ {{- with $.Values.envFrom }}
89
94
envFrom :
90
- {{- toYaml . | nindent 12 }}
91
- {{- end }}
95
+ {{- toYaml . | nindent 12 }}
96
+ {{- end }}
97
+
92
98
volumeMounts :
93
- {{- if $.Values.geoip.enabled }}
99
+ {{- if $.Values.geoip.enabled }}
94
100
- name : geoip-db
95
101
mountPath : /geoip
96
- {{- end }}
102
+ {{- end }}
103
+
104
+ {{- if eq $component "worker" -}}
97
105
{{- if $.Values.sidecar.blueprints.enabled }}
98
106
- name : sidecar-blueprints
99
107
mountPath : /blueprints/sidecar
100
108
{{- end }}
101
- {{- with $.Values.volumeMounts }}
102
- {{- toYaml . | nindent 12 }}
103
- {{- end }}
104
- {{ if eq . "worker" -}}
105
- {{- with $.Values.blueprints }}
106
- {{- range $name := . }}
109
+
110
+ {{- range $name := $.Values.blueprints }}
107
111
- name : blueprints-{{ $name }}
108
112
mountPath : /blueprints/mounted/{{ $name }}
109
- {{- end }}
110
113
{{- end }}
111
- {{- end }}
112
- {{- if eq . "server" }}
114
+ {{- end }}{{/* end worker */}}
115
+
116
+ {{- with $.Values.volumeMounts }}
117
+ {{- toYaml . | nindent 12 }}
118
+ {{- end }}
119
+
113
120
ports :
114
121
- name : http
115
122
containerPort : 9000
@@ -120,24 +127,24 @@ spec:
120
127
- name : https
121
128
containerPort : 9443
122
129
protocol : TCP
123
- {{- if $.Values.livenessProbe.enabled }}
124
- {{- with omit $.Values.livenessProbe "enabled" }}
130
+
131
+ {{- with $.Values.livenessProbe }}
132
+ {{- if .enabled }}
125
133
livenessProbe :
126
- {{- toYaml . | nindent 12 }}
127
- {{- end }}
128
- {{- end }}
129
- {{- if $.Values.readinessProbe.enabled }}
130
- {{- with omit $.Values.readinessProbe " enabled" }}
134
+ {{- toYaml . | nindent 12 }}
135
+ {{- end }}
136
+ {{- end }}
137
+ {{- with $.Values.readinessProbe }}
138
+ {{- if . enabled }}
131
139
readinessProbe :
132
- {{- toYaml . | nindent 12 }}
133
- {{- end }}
134
- {{- end }}
135
- {{- end }}
136
- {{- with index $.Values.resources . }}
140
+ {{- toYaml . | nindent 12 }}
141
+ {{- end }}
142
+ {{- end }}
143
+ {{- with (get $.Values.resources $component) }}
137
144
resources :
138
- {{- toYaml . | nindent 12 }}
139
- {{- end }}
140
- {{- if $.Values.geoip.enabled }}
145
+ {{- toYaml . | nindent 12 }}
146
+ {{- end }}
147
+ {{- if $.Values.geoip.enabled }}
141
148
- name : geoip-sidecar
142
149
image : " {{ $.Values.geoip.image }}"
143
150
env :
@@ -154,7 +161,8 @@ spec:
154
161
volumeMounts :
155
162
- name : geoip-db
156
163
mountPath : /usr/share/GeoIP
157
- {{- end }}
164
+ {{- end }}
165
+ {{- if eq $component "worker" }}
158
166
{{- with $.Values.sidecar.blueprints }}
159
167
{{- if .enabled }}
160
168
- name : sidecar-blueprints
@@ -183,7 +191,8 @@ spec:
183
191
mountPath : /blueprints/sidecar
184
192
{{- end }}
185
193
{{- end }}
186
- {{- with $.Values.additionalContainers }}
194
+ {{- end }}{{/* end worker */}}
195
+ {{- with $.Values.additionalContainers }}
187
196
{{- $additionalContainers := list }}
188
197
{{- range $name, $container := . }}
189
198
{{- if not $container.name -}}
@@ -194,24 +203,24 @@ spec:
194
203
{{- tpl (toYaml $additionalContainers) $ | nindent 8 }}
195
204
{{- end }}
196
205
volumes :
197
- {{- if $.Values.geoip.enabled }}
206
+ {{- if $.Values.geoip.enabled }}
198
207
- name : geoip-db
199
208
emptyDir : {}
200
- {{- end }}
201
- {{- if $.Values.sidecar.blueprints.enabled }}
209
+ {{- end }}
210
+ {{- if eq $component "worker" }}
211
+ {{- if $.Values.sidecar.blueprints.enabled }}
202
212
- name : sidecar-blueprints
203
213
emptyDir : {}
204
- {{- end }}
205
- {{- with $.Values.volumes }}
206
- {{- toYaml . | nindent 8 }}
207
- {{- end }}
208
- {{ if eq . "worker" -}}
209
- {{- with $.Values.blueprints }}
210
- {{- range $name := . }}
214
+ {{- end }}
215
+ {{- range $name := $.Values.blueprints }}
211
216
- name : blueprints-{{ $name }}
212
217
configMap :
213
218
name : {{ $name }}
214
219
{{- end }}
215
- {{- end }}
216
- {{- end }}
220
+ {{- end }}{{/* end worker */}}
221
+
222
+ {{- with $.Values.volumes }}
223
+ {{- toYaml . | nindent 8 }}
224
+ {{- end }}
225
+
217
226
{{- end }}
0 commit comments