Skip to content

Commit 9348ed1

Browse files
authored
K8s: Strictly handle basicAuth.enabled in template (#2760)
* K8s: Strictly handle `basicAuth.enabled` in template Signed-off-by: Viet Nguyen Duc <[email protected]> * K8s: Strictly handle redundant configs in output YAML Signed-off-by: Viet Nguyen Duc <[email protected]> --------- Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent c2ac047 commit 9348ed1

10 files changed

+40
-20
lines changed

Diff for: charts/selenium-grid/templates/_helpers.tpl

+6
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,10 @@ template:
419419
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
420420
- secretRef:
421421
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
422+
{{- if $.Values.basicAuth.enabled }}
422423
- secretRef:
423424
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
425+
{{- end }}
424426
{{- with .node.extraEnvFrom }}
425427
{{- tpl (toYaml .) $ | nindent 10 }}
426428
{{- end }}
@@ -547,8 +549,10 @@ template:
547549
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
548550
- configMapRef:
549551
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
552+
{{- if $.Values.basicAuth.enabled }}
550553
- secretRef:
551554
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
555+
{{- end }}
552556
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
553557
- secretRef:
554558
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
@@ -606,8 +610,10 @@ template:
606610
envFrom:
607611
- configMapRef:
608612
name: {{ template "seleniumGrid.uploader.configmap.fullname" $ }}
613+
{{- if $.Values.basicAuth.enabled }}
609614
- secretRef:
610615
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
616+
{{- end }}
611617
- secretRef:
612618
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
613619
{{- with .uploader.extraEnvFrom }}

Diff for: charts/selenium-grid/templates/basic-auth-secret.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if $.Values.basicAuth.create }}
1+
{{- if and $.Values.basicAuth.create $.Values.basicAuth.enabled }}
22
apiVersion: v1
33
kind: Secret
44
metadata:

Diff for: charts/selenium-grid/templates/distributor-deployment.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ spec:
9393
name: {{ template "seleniumGrid.server.configmap.fullname" . }}
9494
- secretRef:
9595
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
96+
{{- if $.Values.basicAuth.enabled }}
9697
- secretRef:
9798
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
99+
{{- end }}
98100
{{- with .Values.components.extraEnvFrom }}
99101
{{- toYaml . | nindent 12 }}
100102
{{- end }}

Diff for: charts/selenium-grid/templates/event-bus-deployment.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,18 @@ spec:
7272
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
7373
- secretRef:
7474
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
75+
{{- if $.Values.basicAuth.enabled }}
7576
- secretRef:
7677
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
78+
{{- end }}
7779
{{- with .Values.components.extraEnvFrom }}
7880
{{- toYaml . | nindent 12 }}
7981
{{- end }}
8082
{{- with .Values.components.eventBus.extraEnvFrom }}
8183
{{- toYaml . | nindent 12 }}
8284
{{- end }}
83-
volumeMounts:
8485
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
86+
volumeMounts:
8587
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
8688
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
8789
readOnly: true
@@ -99,8 +101,8 @@ spec:
99101
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
100102
affinity: {{- toYaml $affinityYaml | nindent 8 }}
101103
{{- end }}
102-
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
103-
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
104+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.eventBus.topologySpreadConstraints }}
105+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.eventBus.topologySpreadConstraints }}
104106
topologySpreadConstraints:
105107
{{- range $constraint := $topologySpreadConstraints }}
106108
- {{ toYaml $constraint | nindent 10 | trim }}
@@ -121,8 +123,8 @@ spec:
121123
{{- with .Values.components.eventBus.priorityClassName }}
122124
priorityClassName: {{ . }}
123125
{{- end }}
124-
volumes:
125126
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
127+
volumes:
126128
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
127129
secret:
128130
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}

Diff for: charts/selenium-grid/templates/hub-deployment.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ spec:
145145
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
146146
- secretRef:
147147
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
148+
{{- if $.Values.basicAuth.enabled }}
148149
- secretRef:
149150
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
151+
{{- end }}
150152
{{- with .Values.hub.extraEnvFrom }}
151153
{{- toYaml . | nindent 12 }}
152154
{{- end }}
@@ -182,8 +184,8 @@ spec:
182184
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
183185
affinity: {{- toYaml $affinityYaml | nindent 8 }}
184186
{{- end }}
185-
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
186-
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
187+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.hub.topologySpreadConstraints }}
188+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.hub.topologySpreadConstraints }}
187189
topologySpreadConstraints:
188190
{{- range $constraint := $topologySpreadConstraints }}
189191
- {{ toYaml $constraint | nindent 10 | trim }}

Diff for: charts/selenium-grid/templates/patch-keda/patch-keda-objects-cm.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ data:
2929
-o jsonpath='{.items[*].metadata.name}{"\n"}');
3030
do
3131
if [ -n "$i" ]; then
32-
kubectl delete ScaledObjects $i -n {{ .Release.Namespace }}
32+
kubectl delete ScaledObjects $i -n {{ .Release.Namespace }} --wait=false --cascade=foreground
3333
fi
3434
done
3535
for i in $(kubectl get ScaledJobs -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} \
3636
-o jsonpath='{.items[*].metadata.name}{"\n"}');
3737
do
3838
if [ -n "$i" ]; then
39-
kubectl delete ScaledJobs $i -n {{ .Release.Namespace }}
39+
kubectl delete ScaledJobs $i -n {{ .Release.Namespace }} --wait=false
4040
fi
4141
done
4242
for i in $(kubectl get TriggerAuthentication -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} \
4343
-o jsonpath='{.items[*].metadata.name}{"\n"}');
4444
do
4545
if [ -n "$i" ]; then
46-
kubectl delete TriggerAuthentication $i -n {{ .Release.Namespace }}
46+
kubectl delete TriggerAuthentication $i -n {{ .Release.Namespace }} --wait=false
4747
fi
4848
done
4949
{{- end }}

Diff for: charts/selenium-grid/templates/router-deployment.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ spec:
8686
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
8787
- secretRef:
8888
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
89+
{{- if $.Values.basicAuth.enabled }}
8990
- secretRef:
9091
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
92+
{{- end }}
9193
{{- with .Values.components.extraEnvFrom }}
9294
{{- toYaml . | nindent 12 }}
9395
{{- end }}
@@ -172,8 +174,8 @@ spec:
172174
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
173175
affinity: {{- toYaml $affinityYaml | nindent 8 }}
174176
{{- end }}
175-
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
176-
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
177+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.router.topologySpreadConstraints }}
178+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.router.topologySpreadConstraints }}
177179
topologySpreadConstraints:
178180
{{- range $constraint := $topologySpreadConstraints }}
179181
- {{ toYaml $constraint | nindent 10 | trim }}

Diff for: charts/selenium-grid/templates/session-map-deployment.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ spec:
6868
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
6969
- secretRef:
7070
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
71+
{{- if $.Values.basicAuth.enabled }}
7172
- secretRef:
7273
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
74+
{{- end }}
7375
- configMapRef:
7476
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
7577
{{- with .Values.components.extraEnvFrom }}
@@ -78,8 +80,8 @@ spec:
7880
{{- with .Values.components.sessionMap.extraEnvFrom }}
7981
{{- toYaml . | nindent 12 }}
8082
{{- end }}
81-
volumeMounts:
8283
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
84+
volumeMounts:
8385
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
8486
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
8587
readOnly: true
@@ -100,8 +102,8 @@ spec:
100102
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
101103
affinity: {{- toYaml $affinityYaml | nindent 8 }}
102104
{{- end }}
103-
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
104-
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
105+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionMap.topologySpreadConstraints }}
106+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionMap.topologySpreadConstraints }}
105107
topologySpreadConstraints:
106108
{{- range $constraint := $topologySpreadConstraints }}
107109
- {{ toYaml $constraint | nindent 10 | trim }}
@@ -122,8 +124,8 @@ spec:
122124
{{- with .Values.components.sessionMap.priorityClassName }}
123125
priorityClassName: {{ . }}
124126
{{- end }}
125-
volumes:
126127
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
128+
volumes:
127129
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
128130
secret:
129131
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}

Diff for: charts/selenium-grid/templates/session-queue-deployment.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,18 @@ spec:
6565
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
6666
- secretRef:
6767
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
68+
{{- if $.Values.basicAuth.enabled }}
6869
- secretRef:
6970
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
71+
{{- end }}
7072
{{- with .Values.components.extraEnvFrom }}
7173
{{- toYaml . | nindent 12 }}
7274
{{- end }}
7375
{{- with .Values.components.sessionQueue.extraEnvFrom }}
7476
{{- toYaml . | nindent 12 }}
7577
{{- end }}
76-
volumeMounts:
7778
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
79+
volumeMounts:
7880
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
7981
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
8082
readOnly: true
@@ -95,8 +97,8 @@ spec:
9597
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
9698
affinity: {{- toYaml $affinityYaml | nindent 8 }}
9799
{{- end }}
98-
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
99-
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
100+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionQueue.topologySpreadConstraints }}
101+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionQueue.topologySpreadConstraints }}
100102
topologySpreadConstraints:
101103
{{- range $constraint := $topologySpreadConstraints }}
102104
- {{ toYaml $constraint | nindent 10 | trim }}
@@ -117,8 +119,8 @@ spec:
117119
{{- with .Values.components.sessionQueue.priorityClassName }}
118120
priorityClassName: {{ . }}
119121
{{- end }}
120-
volumes:
121122
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
123+
volumes:
122124
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
123125
secret:
124126
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}

Diff for: charts/selenium-grid/templates/trigger-auth.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ spec:
1818
- parameter: url
1919
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
2020
key: SE_NODE_GRID_GRAPHQL_URL
21+
{{- if $.Values.basicAuth.enabled }}
2122
- parameter: username
2223
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
2324
key: SE_ROUTER_USERNAME
2425
- parameter: password
2526
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
2627
key: SE_ROUTER_PASSWORD
28+
{{- end }}
2729
{{- end }}

0 commit comments

Comments
 (0)