Skip to content

Commit 8019879

Browse files
Custom Ingress Path for Helm Chart (#1834)
* Added ingress path option to helm values file * Update README.md * Update README.md * Update README.md * Update ingress.yaml * Updated chart version * Update Chart.yaml * Add explicit SE_HUB_SUB_PATH environment variable for the HUB * Add SE_SUB_PATH to recommended scripts and added documentation * Added sub_path helm value for hub and components * Removed sub_path from components that do not use it --------- Co-authored-by: Diego Molina <[email protected]>
1 parent 22355a7 commit 8019879

File tree

10 files changed

+48
-5
lines changed

10 files changed

+48
-5
lines changed

Hub/start-selenium-grid-hub.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if [ ! -z "$SE_HUB_PORT" ]; then
1717
PORT_CONFIG="--port ${SE_HUB_PORT}"
1818
fi
1919

20+
if [ ! -z "$SE_SUB_PATH" ]; then
21+
echo "Using SE_SUB_PATH: ${SE_SUB_PATH}"
22+
SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}"
23+
fi
24+
2025
EXTRA_LIBS="/opt/selenium/selenium-http-jdk-client.jar"
2126

2227
if [ ! -z "$SE_ENABLE_TRACING" ]; then
@@ -39,4 +44,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \
3944
--config /opt/selenium/config.toml \
4045
${HOST_CONFIG} \
4146
${PORT_CONFIG} \
47+
${SUB_PATH_CONFIG} \
4248
${SE_OPTS}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Talk to us at https://www.selenium.dev/support/
4545
+ [SE_OPTS Selenium Configuration Options](#se_opts-selenium-configuration-options)
4646
+ [SE_JAVA_OPTS Java Environment Options](#se_java_opts-java-environment-options)
4747
+ [Node configuration options](#node-configuration-options)
48+
+ [Setting Sub Path](#setting-sub-path)
4849
+ [Setting Screen Resolution](#setting-screen-resolution)
4950
+ [Grid Url and Session Timeout](#grid-url-and-session-timeout)
5051
+ [Session request timeout](#session-request-timeout)
@@ -793,6 +794,15 @@ $ docker run -d \
793794
--shm-size="2g" selenium/node-chrome:4.9.1-20230508
794795
```
795796

797+
### Setting Sub Path
798+
799+
By default, Selenium is reachable at `http://127.0.0.1:4444/`. Selenium can be configured to use a custom sub path by specifying the `SE_SUB_PATH`
800+
environmental variable. In the example below Selenium is reachable at `http://127.0.0.1:4444/selenium-grid/`
801+
802+
```bash
803+
$ docker run -d -p 4444:4444 -e SE_SUB_PATH=/selenium-grid/ --name selenium-hub selenium/hub:4.9.0-20230421
804+
```
805+
796806
### Setting Screen Resolution
797807

798808
By default, nodes start with a screen resolution of 1360 x 1020 with a color depth of 24 bits and a dpi of 96.

Router/start-selenium-grid-router.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ if [[ -z "${SE_SESSION_QUEUE_PORT}" ]]; then
3535
exit 1
3636
fi
3737

38+
if [ ! -z "$SE_SUB_PATH" ]; then
39+
echo "Using SE_SUB_PATH: ${SE_SUB_PATH}"
40+
SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}"
41+
fi
42+
3843
if [ ! -z "$SE_OPTS" ]; then
3944
echo "Appending Selenium options: ${SE_OPTS}"
4045
fi
@@ -72,4 +77,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \
7277
--bind-host ${SE_BIND_HOST} \
7378
${HOST_CONFIG} \
7479
${PORT_CONFIG} \
80+
${SUB_PATH_CONFIG} \
7581
${SE_OPTS}

Standalone/start-selenium-standalone.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
#
33
# IMPORTANT: Change this file only in directory Standalone!
44

5+
if [ ! -z "$SE_SUB_PATH" ]; then
6+
echo "Using SE_SUB_PATH: ${SE_SUB_PATH}"
7+
SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}"
8+
fi
9+
510
if [ ! -z "$SE_OPTS" ]; then
611
echo "Appending Selenium options: ${SE_OPTS}"
712
fi
@@ -28,4 +33,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \
2833
--ext ${EXTRA_LIBS} standalone \
2934
--bind-host ${SE_BIND_HOST} \
3035
--config /opt/selenium/config.toml \
36+
${SUB_PATH_CONFIG} \
3137
${SE_OPTS}

charts/selenium-grid/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
name: selenium-grid
33
description: A Helm chart for creating a Selenium Grid Server in Kubernetes
44
type: application
5-
version: 0.15.8
5+
version: 0.16.0
66
appVersion: 4.9.0-20230421
77
icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png

charts/selenium-grid/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ This table contains the configuration parameters of the chart and their default
6565
| `ingress.className` | `""` | Name of ingress class to select which controller will implement ingress resource |
6666
| `ingress.annotations` | `{}` | Custom annotations for ingress resource |
6767
| `ingress.hostname` | `selenium-grid.local` | Default host for the ingress resource |
68+
| `ingress.path` | `/` | Default host path for the ingress resource |
6869
| `ingress.tls` | `[]` | TLS backend configuration for ingress resource |
6970
| `busConfigMap.annotations` | `{}` | Custom annotations for configmap |
7071
| `chromeNode.enabled` | `true` | Enable chrome nodes |
@@ -174,6 +175,7 @@ You can configure the Selenium Hub with this values:
174175
| `hub.tolerations` | `[]` | Tolerations for selenium-hub pods |
175176
| `hub.nodeSelector` | `{}` | Node Selector for selenium-hub pods |
176177
| `hub.priorityClassName` | `""` | Priority class name for selenium-hub pods |
178+
| `hub.subPath` | `/` | Custom sub path for the hub deployment |
177179
| `hub.extraEnvironmentVariables` | `nil` | Custom environment variables for selenium-hub |
178180
| `hub.extraEnvFrom` | `nil` | Custom environment variables for selenium taken from `configMap` or `secret`-hub |
179181
| `hub.resources` | `{}` | Resources for selenium-hub container |
@@ -252,6 +254,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru
252254
| `components.sessionQueue.tolerations` | `[]` | Tolerations for Session Queue pods |
253255
| `components.sessionQueue.nodeSelector` | `{}` | Node Selector for Session Queue pods |
254256
| `components.sessionQueue.priorityClassName` | `""` | Priority class name for Session Queue pods |
257+
| `components.subPath` | `/` | Custom sub path for all components |
255258
| `components.extraEnvironmentVariables` | `nil` | Custom environment variables for all components |
256259
| `components.extraEnvFrom` | `nil` | Custom environment variables taken from `configMap` or `secret` for all components |
257260

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ spec:
6161
successThreshold: {{ .Values.hub.readinessProbe.successThreshold }}
6262
failureThreshold: {{ .Values.hub.readinessProbe.failureThreshold }}
6363
{{- end }}
64-
{{- with .Values.hub.extraEnvironmentVariables }}
65-
env: {{- tpl (toYaml .) $ | nindent 12 }}
66-
{{- end }}
64+
env:
65+
- name: SE_SUB_PATH
66+
value: {{ .Values.hub.subPath }}
67+
{{- with .Values.hub.extraEnvironmentVariables }}
68+
{{- tpl (toYaml .) $ | nindent 12 }}
69+
{{- end }}
6770
{{- with .Values.hub.extraEnvFrom }}
6871
envFrom:
6972
{{- toYaml . | nindent 12 }}

charts/selenium-grid/templates/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
{{- end }}
4747
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.Version }}
4848
paths:
49-
- path: /
49+
- path: {{ $.Values.ingress.path | default "/" }}
5050
pathType: Prefix
5151
backend:
5252
service:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ spec:
4242
value: {{ template "seleniumGrid.sessionQueue.fullname" . }}
4343
- name: SE_SESSION_QUEUE_PORT
4444
value: {{ .Values.components.sessionQueue.port | quote }}
45+
- name: SE_SUB_PATH
46+
value: {{ .Values.components.subPath }}
4547
{{- with .Values.components.extraEnvironmentVariables }}
4648
{{- tpl (toYaml .) $ | nindent 12 }}
4749
{{- end }}

charts/selenium-grid/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ingress:
2020
annotations: {}
2121
# Default host for the ingress resource
2222
hostname: selenium-grid.local
23+
# Default host path for the ingress resource
24+
path: /
2325
# TLS backend configuration for ingress resource
2426
tls: []
2527

@@ -200,6 +202,9 @@ components:
200202
# Priority class name for Session Queue pods
201203
priorityClassName: ""
202204

205+
# Custom sub path for all components
206+
subPath: /
207+
203208
# Custom environment variables for all components
204209
extraEnvironmentVariables:
205210
# - name: SE_JAVA_OPTS
@@ -256,6 +261,8 @@ hub:
256261
timeoutSeconds: 10
257262
periodSeconds: 10
258263
successThreshold: 1
264+
# Custom sub path for the hub deployment
265+
subPath: /
259266
# Custom environment variables for selenium-hub
260267
extraEnvironmentVariables:
261268
# - name: SE_JAVA_OPTS

0 commit comments

Comments
 (0)