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,34 @@ 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
+
120
+ {{- if eq $component "server" }}
113
121
ports :
114
122
- name : http
115
123
containerPort : 9000
@@ -120,24 +128,25 @@ spec:
120
128
- name : https
121
129
containerPort : 9443
122
130
protocol : TCP
123
- {{- if $.Values.livenessProbe.enabled }}
124
- {{- with omit $.Values.livenessProbe " enabled" }}
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
+ {{- end }}{{/* end server */}}
144
+
145
+ {{- with (get $.Values.resources $component) }}
137
146
resources :
138
- {{- toYaml . | nindent 12 }}
139
- {{- end }}
140
- {{- if $.Values.geoip.enabled }}
147
+ {{- toYaml . | nindent 12 }}
148
+ {{- end }}
149
+ {{- if $.Values.geoip.enabled }}
141
150
- name : geoip-sidecar
142
151
image : " {{ $.Values.geoip.image }}"
143
152
env :
@@ -154,7 +163,8 @@ spec:
154
163
volumeMounts :
155
164
- name : geoip-db
156
165
mountPath : /usr/share/GeoIP
157
- {{- end }}
166
+ {{- end }}
167
+ {{- if eq $component "worker" }}
158
168
{{- with $.Values.sidecar.blueprints }}
159
169
{{- if .enabled }}
160
170
- name : sidecar-blueprints
@@ -183,7 +193,8 @@ spec:
183
193
mountPath : /blueprints/sidecar
184
194
{{- end }}
185
195
{{- end }}
186
- {{- with $.Values.additionalContainers }}
196
+ {{- end }}{{/* end worker */}}
197
+ {{- with $.Values.additionalContainers }}
187
198
{{- $additionalContainers := list }}
188
199
{{- range $name, $container := . }}
189
200
{{- if not $container.name -}}
@@ -194,24 +205,24 @@ spec:
194
205
{{- tpl (toYaml $additionalContainers) $ | nindent 8 }}
195
206
{{- end }}
196
207
volumes :
197
- {{- if $.Values.geoip.enabled }}
208
+ {{- if $.Values.geoip.enabled }}
198
209
- name : geoip-db
199
210
emptyDir : {}
200
- {{- end }}
201
- {{- if $.Values.sidecar.blueprints.enabled }}
211
+ {{- end }}
212
+ {{- if eq $component "worker" }}
213
+ {{- if $.Values.sidecar.blueprints.enabled }}
202
214
- name : sidecar-blueprints
203
215
emptyDir : {}
204
- {{- end }}
205
- {{- with $.Values.volumes }}
206
- {{- toYaml . | nindent 8 }}
207
- {{- end }}
208
- {{ if eq . "worker" -}}
209
- {{- with $.Values.blueprints }}
210
- {{- range $name := . }}
216
+ {{- end }}
217
+ {{- range $name := $.Values.blueprints }}
211
218
- name : blueprints-{{ $name }}
212
219
configMap :
213
220
name : {{ $name }}
214
221
{{- end }}
215
- {{- end }}
216
- {{- end }}
222
+ {{- end }}{{/* end worker */}}
223
+
224
+ {{- with $.Values.volumes }}
225
+ {{- toYaml . | nindent 8 }}
226
+ {{- end }}
227
+
217
228
{{- end }}
0 commit comments