diff --git a/Hub/start-selenium-grid-hub.sh b/Hub/start-selenium-grid-hub.sh index 0ca6aac67..efc34668d 100755 --- a/Hub/start-selenium-grid-hub.sh +++ b/Hub/start-selenium-grid-hub.sh @@ -17,6 +17,11 @@ if [ ! -z "$SE_HUB_PORT" ]; then PORT_CONFIG="--port ${SE_HUB_PORT}" fi +if [ ! -z "$SE_SUB_PATH" ]; then + echo "Using SE_SUB_PATH: ${SE_SUB_PATH}" + SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}" +fi + EXTRA_LIBS="/opt/selenium/selenium-http-jdk-client.jar" if [ ! -z "$SE_ENABLE_TRACING" ]; then @@ -39,4 +44,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \ --config /opt/selenium/config.toml \ ${HOST_CONFIG} \ ${PORT_CONFIG} \ + ${SUB_PATH_CONFIG} \ ${SE_OPTS} diff --git a/README.md b/README.md index d23098664..2414e7780 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Talk to us at https://www.selenium.dev/support/ + [SE_OPTS Selenium Configuration Options](#se_opts-selenium-configuration-options) + [SE_JAVA_OPTS Java Environment Options](#se_java_opts-java-environment-options) + [Node configuration options](#node-configuration-options) + + [Setting Sub Path](#setting-sub-path) + [Setting Screen Resolution](#setting-screen-resolution) + [Grid Url and Session Timeout](#grid-url-and-session-timeout) + [Session request timeout](#session-request-timeout) @@ -793,6 +794,15 @@ $ docker run -d \ --shm-size="2g" selenium/node-chrome:4.9.1-20230508 ``` +### Setting Sub Path + +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` +environmental variable. In the example below Selenium is reachable at `http://127.0.0.1:4444/selenium-grid/` + +```bash +$ docker run -d -p 4444:4444 -e SE_SUB_PATH=/selenium-grid/ --name selenium-hub selenium/hub:4.9.0-20230421 +``` + ### Setting Screen Resolution By default, nodes start with a screen resolution of 1360 x 1020 with a color depth of 24 bits and a dpi of 96. diff --git a/Router/start-selenium-grid-router.sh b/Router/start-selenium-grid-router.sh index 07c5f57ca..b99f675e5 100755 --- a/Router/start-selenium-grid-router.sh +++ b/Router/start-selenium-grid-router.sh @@ -35,6 +35,11 @@ if [[ -z "${SE_SESSION_QUEUE_PORT}" ]]; then exit 1 fi +if [ ! -z "$SE_SUB_PATH" ]; then + echo "Using SE_SUB_PATH: ${SE_SUB_PATH}" + SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}" +fi + if [ ! -z "$SE_OPTS" ]; then echo "Appending Selenium options: ${SE_OPTS}" fi @@ -72,4 +77,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \ --bind-host ${SE_BIND_HOST} \ ${HOST_CONFIG} \ ${PORT_CONFIG} \ + ${SUB_PATH_CONFIG} \ ${SE_OPTS} diff --git a/Standalone/start-selenium-standalone.sh b/Standalone/start-selenium-standalone.sh index 2cf5a6978..7af58b6e8 100755 --- a/Standalone/start-selenium-standalone.sh +++ b/Standalone/start-selenium-standalone.sh @@ -2,6 +2,11 @@ # # IMPORTANT: Change this file only in directory Standalone! +if [ ! -z "$SE_SUB_PATH" ]; then + echo "Using SE_SUB_PATH: ${SE_SUB_PATH}" + SUB_PATH_CONFIG="--sub-path ${SE_SUB_PATH}" +fi + if [ ! -z "$SE_OPTS" ]; then echo "Appending Selenium options: ${SE_OPTS}" fi @@ -28,4 +33,5 @@ java ${JAVA_OPTS:-$SE_JAVA_OPTS} -Dwebdriver.http.factory=jdk-http-client \ --ext ${EXTRA_LIBS} standalone \ --bind-host ${SE_BIND_HOST} \ --config /opt/selenium/config.toml \ + ${SUB_PATH_CONFIG} \ ${SE_OPTS} \ No newline at end of file diff --git a/charts/selenium-grid/Chart.yaml b/charts/selenium-grid/Chart.yaml index 7c657fdea..65ae15dcc 100644 --- a/charts/selenium-grid/Chart.yaml +++ b/charts/selenium-grid/Chart.yaml @@ -2,6 +2,6 @@ apiVersion: v2 name: selenium-grid description: A Helm chart for creating a Selenium Grid Server in Kubernetes type: application -version: 0.15.8 +version: 0.16.0 appVersion: 4.9.0-20230421 icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index adfc3fcd2..3a8cfc4b3 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -65,6 +65,7 @@ This table contains the configuration parameters of the chart and their default | `ingress.className` | `""` | Name of ingress class to select which controller will implement ingress resource | | `ingress.annotations` | `{}` | Custom annotations for ingress resource | | `ingress.hostname` | `selenium-grid.local` | Default host for the ingress resource | +| `ingress.path` | `/` | Default host path for the ingress resource | | `ingress.tls` | `[]` | TLS backend configuration for ingress resource | | `busConfigMap.annotations` | `{}` | Custom annotations for configmap | | `chromeNode.enabled` | `true` | Enable chrome nodes | @@ -174,6 +175,7 @@ You can configure the Selenium Hub with this values: | `hub.tolerations` | `[]` | Tolerations for selenium-hub pods | | `hub.nodeSelector` | `{}` | Node Selector for selenium-hub pods | | `hub.priorityClassName` | `""` | Priority class name for selenium-hub pods | +| `hub.subPath` | `/` | Custom sub path for the hub deployment | | `hub.extraEnvironmentVariables` | `nil` | Custom environment variables for selenium-hub | | `hub.extraEnvFrom` | `nil` | Custom environment variables for selenium taken from `configMap` or `secret`-hub | | `hub.resources` | `{}` | Resources for selenium-hub container | @@ -252,6 +254,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.sessionQueue.tolerations` | `[]` | Tolerations for Session Queue pods | | `components.sessionQueue.nodeSelector` | `{}` | Node Selector for Session Queue pods | | `components.sessionQueue.priorityClassName` | `""` | Priority class name for Session Queue pods | +| `components.subPath` | `/` | Custom sub path for all components | | `components.extraEnvironmentVariables` | `nil` | Custom environment variables for all components | | `components.extraEnvFrom` | `nil` | Custom environment variables taken from `configMap` or `secret` for all components | diff --git a/charts/selenium-grid/templates/hub-deployment.yaml b/charts/selenium-grid/templates/hub-deployment.yaml index 29074c2dd..2518e497f 100644 --- a/charts/selenium-grid/templates/hub-deployment.yaml +++ b/charts/selenium-grid/templates/hub-deployment.yaml @@ -61,9 +61,12 @@ spec: successThreshold: {{ .Values.hub.readinessProbe.successThreshold }} failureThreshold: {{ .Values.hub.readinessProbe.failureThreshold }} {{- end }} - {{- with .Values.hub.extraEnvironmentVariables }} - env: {{- tpl (toYaml .) $ | nindent 12 }} - {{- end }} + env: + - name: SE_SUB_PATH + value: {{ .Values.hub.subPath }} + {{- with .Values.hub.extraEnvironmentVariables }} + {{- tpl (toYaml .) $ | nindent 12 }} + {{- end }} {{- with .Values.hub.extraEnvFrom }} envFrom: {{- toYaml . | nindent 12 }} diff --git a/charts/selenium-grid/templates/ingress.yaml b/charts/selenium-grid/templates/ingress.yaml index cc20bf520..6df2c9553 100644 --- a/charts/selenium-grid/templates/ingress.yaml +++ b/charts/selenium-grid/templates/ingress.yaml @@ -46,7 +46,7 @@ spec: {{- end }} {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.Version }} paths: - - path: / + - path: {{ $.Values.ingress.path | default "/" }} pathType: Prefix backend: service: diff --git a/charts/selenium-grid/templates/router-deployment.yaml b/charts/selenium-grid/templates/router-deployment.yaml index 3f94706fd..5eb4f99e9 100644 --- a/charts/selenium-grid/templates/router-deployment.yaml +++ b/charts/selenium-grid/templates/router-deployment.yaml @@ -42,6 +42,8 @@ spec: value: {{ template "seleniumGrid.sessionQueue.fullname" . }} - name: SE_SESSION_QUEUE_PORT value: {{ .Values.components.sessionQueue.port | quote }} + - name: SE_SUB_PATH + value: {{ .Values.components.subPath }} {{- with .Values.components.extraEnvironmentVariables }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index e65a73530..ebcd387f5 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -20,6 +20,8 @@ ingress: annotations: {} # Default host for the ingress resource hostname: selenium-grid.local + # Default host path for the ingress resource + path: / # TLS backend configuration for ingress resource tls: [] @@ -200,6 +202,9 @@ components: # Priority class name for Session Queue pods priorityClassName: "" + # Custom sub path for all components + subPath: / + # Custom environment variables for all components extraEnvironmentVariables: # - name: SE_JAVA_OPTS @@ -256,6 +261,8 @@ hub: timeoutSeconds: 10 periodSeconds: 10 successThreshold: 1 + # Custom sub path for the hub deployment + subPath: / # Custom environment variables for selenium-hub extraEnvironmentVariables: # - name: SE_JAVA_OPTS