Skip to content

K8s: Strictly handle basicAuth.enabled in template #2760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ template:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .node.extraEnvFrom }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
Expand Down Expand Up @@ -547,8 +549,10 @@ template:
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
- secretRef:
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
Expand Down Expand Up @@ -606,8 +610,10 @@ template:
envFrom:
- configMapRef:
name: {{ template "seleniumGrid.uploader.configmap.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
- secretRef:
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
{{- with .uploader.extraEnvFrom }}
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/basic-auth-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if $.Values.basicAuth.create }}
{{- if and $.Values.basicAuth.create $.Values.basicAuth.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
2 changes: 2 additions & 0 deletions charts/selenium-grid/templates/distributor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" . }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .Values.components.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
10 changes: 6 additions & 4 deletions charts/selenium-grid/templates/event-bus-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,18 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .Values.components.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.components.eventBus.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumeMounts:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
readOnly: true
Expand All @@ -99,8 +101,8 @@ spec:
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.eventBus.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.eventBus.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
Expand All @@ -121,8 +123,8 @@ spec:
{{- with .Values.components.eventBus.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
volumes:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumes:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
secret:
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}
Expand Down
6 changes: 4 additions & 2 deletions charts/selenium-grid/templates/hub-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .Values.hub.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -182,8 +184,8 @@ spec:
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.hub.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.hub.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ data:
-o jsonpath='{.items[*].metadata.name}{"\n"}');
do
if [ -n "$i" ]; then
kubectl delete ScaledObjects $i -n {{ .Release.Namespace }}
kubectl delete ScaledObjects $i -n {{ .Release.Namespace }} --wait=false --cascade=foreground
fi
done
for i in $(kubectl get ScaledJobs -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} \
-o jsonpath='{.items[*].metadata.name}{"\n"}');
do
if [ -n "$i" ]; then
kubectl delete ScaledJobs $i -n {{ .Release.Namespace }}
kubectl delete ScaledJobs $i -n {{ .Release.Namespace }} --wait=false
fi
done
for i in $(kubectl get TriggerAuthentication -n {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }} \
-o jsonpath='{.items[*].metadata.name}{"\n"}');
do
if [ -n "$i" ]; then
kubectl delete TriggerAuthentication $i -n {{ .Release.Namespace }}
kubectl delete TriggerAuthentication $i -n {{ .Release.Namespace }} --wait=false
fi
done
{{- end }}
Expand Down
6 changes: 4 additions & 2 deletions charts/selenium-grid/templates/router-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .Values.components.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -172,8 +174,8 @@ spec:
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.router.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.router.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
Expand Down
10 changes: 6 additions & 4 deletions charts/selenium-grid/templates/session-map-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
- configMapRef:
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
{{- with .Values.components.extraEnvFrom }}
Expand All @@ -78,8 +80,8 @@ spec:
{{- with .Values.components.sessionMap.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumeMounts:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
readOnly: true
Expand All @@ -100,8 +102,8 @@ spec:
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionMap.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionMap.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
Expand All @@ -122,8 +124,8 @@ spec:
{{- with .Values.components.sessionMap.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
volumes:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumes:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
secret:
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}
Expand Down
10 changes: 6 additions & 4 deletions charts/selenium-grid/templates/session-queue-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ spec:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .Values.components.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.components.sessionQueue.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumeMounts:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
mountPath: {{ .Values.tls.certVolumeMountPath | quote }}
readOnly: true
Expand All @@ -95,8 +97,8 @@ spec:
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionQueue.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.sessionQueue.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
Expand All @@ -117,8 +119,8 @@ spec:
{{- with .Values.components.sessionQueue.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
volumes:
{{- if eq (include "seleniumGrid.server.secureConnection" $) "true" }}
volumes:
- name: {{ include "seleniumGrid.tls.fullname" . | quote }}
secret:
secretName: {{ include "seleniumGrid.tls.fullname" . | quote }}
Expand Down
2 changes: 2 additions & 0 deletions charts/selenium-grid/templates/trigger-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ spec:
- parameter: url
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
key: SE_NODE_GRID_GRAPHQL_URL
{{- if $.Values.basicAuth.enabled }}
- parameter: username
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
key: SE_ROUTER_USERNAME
- parameter: password
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
key: SE_ROUTER_PASSWORD
{{- end }}
{{- end }}
Loading