Skip to content

Commit 861383c

Browse files
trungprivatetrungsonardiemol
authored
Feat: support grid basic auth on helm chart (#1894)
* implement basic auth in helm chart Updated helm chart templates to allow basic auth to be enabled/disabled through values.yaml * implement basic auth in helm chart Updated helm chart templates to allow basic auth to be enabled/disabled through values.yaml --------- Co-authored-by: Trung Le <[email protected]> Co-authored-by: Diego Molina <[email protected]>
1 parent 5427fef commit 861383c

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ Get the url of the grid. If the external url can be figured out from the ingress
186186
*/}}
187187
{{- define "seleniumGrid.url" -}}
188188
{{- if and .Values.ingress.enabled .Values.ingress.hostname (ne .Values.ingress.hostname "selenium-grid.local") -}}
189-
http{{if .Values.ingress.tls}}s{{end}}://{{.Values.ingress.hostname}}
189+
http{{if .Values.ingress.tls}}s{{end}}://{{- if eq .Values.basicAuth.enabled true}}{{ .Values.basicAuth.username}}:{{ .Values.basicAuth.password}}@{{- end}}{{.Values.ingress.hostname}}
190190
{{- else -}}
191-
http://{{ include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ }}.{{ .Release.Namespace }}:{{ $.Values.components.router.port }}
191+
http://{{- if eq .Values.basicAuth.enabled true}}{{ .Values.basicAuth.username}}:{{ .Values.basicAuth.password}}@{{- end}}{{ include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ }}.{{ .Release.Namespace }}:{{ $.Values.components.router.port }}
192192
{{- end }}
193193
{{- end -}}
194194

195195
{{/*
196196
Graphql Url of the hub or the router
197197
*/}}
198198
{{- define "seleniumGrid.graphqlURL" -}}
199-
http://{{ include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ }}.{{ .Release.Namespace }}:{{ $.Values.components.router.port }}/graphql
199+
http://{{- if eq .Values.basicAuth.enabled true}}{{ .Values.basicAuth.username}}:{{ .Values.basicAuth.password}}@{{- end}}{{ include ($.Values.isolateComponents | ternary "seleniumGrid.router.fullname" "seleniumGrid.hub.fullname") $ }}.{{ .Release.Namespace }}:{{ $.Values.components.router.port }}/graphql
200200
{{- end -}}
201201

202202
{{/*

charts/selenium-grid/templates/hub-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ spec:
6464
env:
6565
- name: SE_SUB_PATH
6666
value: {{ .Values.hub.subPath }}
67+
{{- if eq .Values.basicAuth.enabled true}}
68+
- name: ROUTER_USERNAME
69+
value: {{ .Values.basicAuth.username }}
70+
- name: ROUTER_PASSWORD
71+
value: {{ .Values.basicAuth.username }}
72+
{{- end }}
6773
{{- with .Values.hub.extraEnvironmentVariables }}
6874
{{- tpl (toYaml .) $ | nindent 12 }}
6975
{{- end }}

charts/selenium-grid/templates/router-deployment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ spec:
4444
value: {{ .Values.components.sessionQueue.port | quote }}
4545
- name: SE_SUB_PATH
4646
value: {{ .Values.components.subPath }}
47+
{{- if eq .Values.basicAuth.enabled true}}
48+
- name: ROUTER_USERNAME
49+
value: {{ .Values.basicAuth.username }}
50+
- name: ROUTER_PASSWORD
51+
value: {{ .Values.basicAuth.password }}
52+
{{- end }}
4753
{{- with .Values.components.extraEnvironmentVariables }}
4854
{{- tpl (toYaml .) $ | nindent 12 }}
4955
{{- end }}

charts/selenium-grid/values.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ global:
55
# Image tag for browser's nodes
66
nodesImageTag: 4.11.0-20230801
77
# Pull secret for all components, can be overridden individually
8-
imagePullSecret: ""
8+
imagePullSecret: ""
9+
10+
# Basic auth settings for Selenium Grid
11+
basicAuth:
12+
# Enable or disable basic auth
13+
enabled: true
14+
# Username for basic auth
15+
username: admin
16+
# Password for basic auth
17+
password: admin
918

1019
# Deploy Router, Distributor, EventBus, SessionMap and Nodes separately
1120
isolateComponents: false

0 commit comments

Comments
 (0)