diff --git a/Hub/start-selenium-grid-hub.sh b/Hub/start-selenium-grid-hub.sh index 682b28e50..d93a0e92a 100755 --- a/Hub/start-selenium-grid-hub.sh +++ b/Hub/start-selenium-grid-hub.sh @@ -56,6 +56,11 @@ if [ ! -z "$SE_REGISTRATION_SECRET" ]; then SE_OPTS="$SE_OPTS --registration-secret ${SE_REGISTRATION_SECRET}" fi +if [ ! -z "$SE_DISABLE_UI" ]; then + echo "Appending Selenium options: --disable-ui ${SE_DISABLE_UI}" + SE_OPTS="$SE_OPTS --disable-ui ${SE_DISABLE_UI}" +fi + EXTRA_LIBS="" if [ ! -z "$SE_ENABLE_TRACING" ]; then diff --git a/Router/start-selenium-grid-router.sh b/Router/start-selenium-grid-router.sh index 6a7c0bc78..3288abb15 100755 --- a/Router/start-selenium-grid-router.sh +++ b/Router/start-selenium-grid-router.sh @@ -88,6 +88,11 @@ if [ ! -z "$SE_REGISTRATION_SECRET" ]; then SE_OPTS="$SE_OPTS --registration-secret ${SE_REGISTRATION_SECRET}" fi +if [ ! -z "$SE_DISABLE_UI" ]; then + echo "Appending Selenium options: --disable-ui ${SE_DISABLE_UI}" + SE_OPTS="$SE_OPTS --disable-ui ${SE_DISABLE_UI}" +fi + EXTRA_LIBS="" if [ ! -z "$SE_ENABLE_TRACING" ]; then diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 5368ca2ea..ae3a4c00d 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -648,6 +648,7 @@ You can configure the Selenium Hub with these values: | `hub.imagePullSecret` | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry) | | `hub.annotations` | `{}` | Custom annotations for Selenium Hub pod | | `hub.labels` | `{}` | Custom labels for Selenium Hub pod | +| `hub.disableUI` | `false` | Disable the Grid UI | | `hub.publishPort` | `4442` | Port where events are published | | `hub.publishNodePort` | `31442` | NodePort where events are published | | `hub.subscribePort` | `4443` | Port where to subscribe for events | @@ -764,6 +765,7 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.sessionQueue.affinity` | `{}` | Affinity for Session Queue pods | | `components.sessionQueue.priorityClassName` | `""` | Priority class name for Session Queue pods | | `components.subPath` | `/` | Custom sub path for all components | +| `components.disableUI` | `false` | Disable the Grid UI | | `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 e952215a4..00fea3f12 100644 --- a/charts/selenium-grid/templates/hub-deployment.yaml +++ b/charts/selenium-grid/templates/hub-deployment.yaml @@ -95,6 +95,10 @@ spec: - name: SE_SUB_PATH value: {{ . | quote }} {{- end }} + {{- if .Values.hub.disableUI }} + - name: SE_DISABLE_UI + value: {{ .Values.hub.disableUI | quote }} + {{- end }} {{- with .Values.hub.extraEnvironmentVariables }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/router-deployment.yaml b/charts/selenium-grid/templates/router-deployment.yaml index a57e2682c..647b5f1ab 100644 --- a/charts/selenium-grid/templates/router-deployment.yaml +++ b/charts/selenium-grid/templates/router-deployment.yaml @@ -49,6 +49,10 @@ spec: - name: SE_SUB_PATH value: {{ . | quote }} {{- end }} + {{- if .Values.components.disableUI }} + - name: SE_DISABLE_UI + value: {{ .Values.components.disableUI | quote }} + {{- end }} {{- with .Values.components.extraEnvironmentVariables }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index fa29d28b9..6f4e9b7c7 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -336,6 +336,8 @@ components: # Custom sub path for all components subPath: "" + # Disable the Grid UI + disableUI: false # Custom environment variables for all components extraEnvironmentVariables: @@ -370,6 +372,8 @@ hub: annotations: {} # Custom labels for Selenium Hub pods labels: {} + # Disable the Grid UI + disableUI: false # Port where events are published publishPort: 4442 publishNodePort: 31442 diff --git a/tests/charts/templates/render/dummy.yaml b/tests/charts/templates/render/dummy.yaml index b5b2ef971..a5587451a 100644 --- a/tests/charts/templates/render/dummy.yaml +++ b/tests/charts/templates/render/dummy.yaml @@ -58,6 +58,7 @@ isolateComponents: true components: subPath: *gridAppRoot + disableUI: true router: serviceType: NodePort distributor: diff --git a/tests/charts/templates/test.py b/tests/charts/templates/test.py index a40cbd22d..1d0196584 100644 --- a/tests/charts/templates/test.py +++ b/tests/charts/templates/test.py @@ -50,7 +50,7 @@ def test_sub_path_append_to_node_grid_url(self): count = 0 for doc in LIST_OF_DOCUMENTS: if doc['metadata']['name'] in resources_name and doc['kind'] == 'ConfigMap': - logger.info(f"Assert subPath is appended to node grid url") + logger.info(f"Assert subPath is appended to Node env SE_NODE_GRID_URL") self.assertTrue(doc['data']['SE_NODE_GRID_URL'] == 'https://sysadmin:strongPassword@10.10.10.10:8443/selenium') count += 1 self.assertEqual(count, len(resources_name), "No node config resources found") @@ -60,13 +60,25 @@ def test_sub_path_set_to_grid_env_var(self): is_present = False for doc in LIST_OF_DOCUMENTS: if doc['metadata']['name'] in resources_name and doc['kind'] == 'Deployment': - logger.info(f"Assert subPath is set to grid ENV variable") + logger.info(f"Assert subPath is set to Router env SE_SUB_PATH") list_env = doc['spec']['template']['spec']['containers'][0]['env'] for env in list_env: if env['name'] == 'SE_SUB_PATH' and env['value'] == '/selenium': is_present = True self.assertTrue(is_present, "ENV variable SE_SUB_PATH is not populated") + def test_disable_ui_set_to_grid_env_var(self): + resources_name = ['selenium-router'] + is_present = False + for doc in LIST_OF_DOCUMENTS: + if doc['metadata']['name'] in resources_name and doc['kind'] == 'Deployment': + logger.info(f"Assert option disable UI is set to Router env SE_DISABLE_UI") + list_env = doc['spec']['template']['spec']['containers'][0]['env'] + for env in list_env: + if env['name'] == 'SE_DISABLE_UI' and env['value'] == 'true': + is_present = True + self.assertTrue(is_present, "ENV variable SE_DISABLE_UI is not populated") + def test_log_level_set_to_logging_config_map(self): resources_name = ['selenium-chrome-node', 'selenium-distributor', 'selenium-edge-node', 'selenium-firefox-node', 'selenium-event-bus', 'selenium-router', 'selenium-session-map', 'selenium-session-queue']