diff --git a/Makefile b/Makefile index 25e6b4014f..6320b57b95 100644 --- a/Makefile +++ b/Makefile @@ -949,7 +949,7 @@ chart_render_template: RENDER_HELM_TEMPLATE_ONLY=true NAMESPACE=$(NAME) KEDA_TAG_VERSION=$(KEDA_TAG_VERSION) BUILD_DATE=$(BUILD_DATE) make chart_test_autoscaling_disabled chart_test_autoscaling_deployment_https chart_test_autoscaling_deployment chart_test_autoscaling_job_https chart_test_autoscaling_job_hostname chart_test_autoscaling_job chart_test_autoscaling_playwright_connect_grid chart_test_autoscaling_disabled: - PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) \ + PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_CUSTOM_SPECIFIC_NAME=true \ SECURE_INGRESS_ONLY_GENERATE=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 EXTERNAL_UPLOADER_CONFIG=true \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_nodeChromium_enableTracing_secureIngress_generateCerts_ingressPublicIP_subPath.yaml" \ @@ -965,7 +965,7 @@ chart_test_autoscaling_deployment_https: chart_test_autoscaling_deployment: PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) AUTOSCALING_COOLDOWN_PERIOD=30 \ - TRACING_EXPORTER_ENDPOINT="http://\$$KUBERNETES_NODE_HOST_IP:4317" \ + TRACING_EXPORTER_ENDPOINT="http://\$$KUBERNETES_NODE_HOST_IP:4317" TEST_CUSTOM_SPECIFIC_NAME=true \ SECURE_CONNECTION_SERVER=true SECURE_USE_EXTERNAL_CERT=true SERVICE_TYPE_NODEPORT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=31444 \ SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 SET_MAX_REPLICAS=3 TEST_DELAY_AFTER_TEST=2 SELENIUM_GRID_MONITORING=false \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ diff --git a/charts/selenium-grid/CONFIGURATION.md b/charts/selenium-grid/CONFIGURATION.md index 54f25b9795..f5d19d9f6d 100644 --- a/charts/selenium-grid/CONFIGURATION.md +++ b/charts/selenium-grid/CONFIGURATION.md @@ -50,6 +50,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually | | global.seleniumGrid.nodeMaxSessions | int | `1` | Specify number of max sessions per node. Can be overridden by individual component (this is also set to scaler trigger parameter `nodeMaxSessions` if `autoscaling` is enabled) | | global.seleniumGrid.nodeEnableManagedDownloads | bool | `false` | This causes the Node to auto manage files downloaded for a given session on the Node (https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#enable-downloads-in-the-grid) | +| global.seleniumGrid.nodeCustomCapabilities | string | `""` | Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes) | | global.seleniumGrid.nodeRegisterPeriod | int | `120` | How long, in seconds, will the Node try to register to the Distributor for the first time. After this period is completed, the Node will not attempt to register again. | | global.seleniumGrid.nodeRegisterCycle | int | `5` | How often, in seconds, the Node will try to register itself for the first time to the Distributor. | | tls.create | bool | `true` | Create a Secret resource for TLS certificate and key. If using an external secret set to false and provide its name in `nameOverride` below | @@ -458,6 +459,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | chromeNode.extraVolumes | list | `[]` | Extra volumes for chrome-node pod | | chromeNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node | | chromeNode.nodeEnableManagedDownloads | string | `nil` | Override the managed downloads in node | +| chromeNode.nodeCustomCapabilities | string | `""` | Override the same config at the global level | | chromeNode.nodeRegisterPeriod | string | `nil` | Override the same config at the global level | | chromeNode.nodeRegisterCycle | string | `nil` | Override the same config at the global level | | chromeNode.scaledOptions | string | `nil` | Override the scaled options for chrome nodes | @@ -467,7 +469,6 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | chromeNode.hpa.sessionBrowserName | string | `"chrome"` | sessionBrowserName if the browserName is different from the sessionBrowserName | | chromeNode.hpa.browserVersion | string | `""` | browserVersion should match with Node stereotype and request capability is scaled by this scaler | | chromeNode.hpa.platformName | string | `""` | platformName should match with Node stereotype and request capability is scaled by this scaler | -| chromeNode.hpa.capabilities | string | `""` | Setting more custom capabilities for matching specific Nodes | | chromeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint | | chromeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option | | chromeNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option | @@ -516,6 +517,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | firefoxNode.extraVolumes | list | `[]` | Extra volumes for firefox-node pod | | firefoxNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node | | firefoxNode.nodeEnableManagedDownloads | string | `nil` | Override the managed downloads in node | +| firefoxNode.nodeCustomCapabilities | string | `""` | Override the same config at the global level | | firefoxNode.nodeRegisterPeriod | string | `nil` | Override the same config at the global level | | firefoxNode.nodeRegisterCycle | string | `nil` | Override the same config at the global level | | firefoxNode.scaledOptions | string | `nil` | Override the scaled options for firefox nodes | @@ -525,7 +527,6 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | firefoxNode.hpa.sessionBrowserName | string | `"firefox"` | sessionBrowserName if the browserName is different from the sessionBrowserName | | firefoxNode.hpa.browserVersion | string | `""` | browserVersion should match with Node stereotype and request capability is scaled by this scaler | | firefoxNode.hpa.platformName | string | `""` | platformName should match with Node stereotype and request capability is scaled by this scaler | -| firefoxNode.hpa.capabilities | string | `""` | Setting more custom capabilities for matching specific Nodes | | firefoxNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint | | firefoxNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option | | firefoxNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option | @@ -574,6 +575,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | edgeNode.extraVolumes | list | `[]` | Extra volumes for edge-node pod | | edgeNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node | | edgeNode.nodeEnableManagedDownloads | string | `nil` | Override the managed downloads in node | +| edgeNode.nodeCustomCapabilities | string | `""` | Override the same config at the global level | | edgeNode.nodeRegisterPeriod | string | `nil` | Override the same config at the global level | | edgeNode.nodeRegisterCycle | string | `nil` | Override the same config at the global level | | edgeNode.scaledOptions | string | `nil` | Override the scaled options for edge nodes | @@ -583,7 +585,6 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | edgeNode.hpa.sessionBrowserName | string | `"msedge"` | sessionBrowserName if the browserName is different from the sessionBrowserName | | edgeNode.hpa.browserVersion | string | `""` | browserVersion should match with Node stereotype and request capability is scaled by this scaler | | edgeNode.hpa.platformName | string | `""` | platformName should match with Node stereotype and request capability is scaled by this scaler | -| edgeNode.hpa.capabilities | string | `""` | Setting more custom capabilities for matching specific Nodes | | edgeNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint | | edgeNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option | | edgeNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option | @@ -632,6 +633,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | relayNode.extraVolumes | list | `[]` | Extra volumes for relay-node pod | | relayNode.nodeMaxSessions | string | `nil` | Override the number of max sessions per node | | relayNode.nodeEnableManagedDownloads | string | `nil` | Override the managed downloads in node | +| relayNode.nodeCustomCapabilities | string | `""` | Override the same config at the global level | | relayNode.nodeRegisterPeriod | string | `nil` | Override the same config at the global level | | relayNode.nodeRegisterCycle | string | `nil` | Override the same config at the global level | | relayNode.scaledOptions | string | `nil` | Override the scaled options for relay nodes | @@ -641,7 +643,6 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | relayNode.hpa.sessionBrowserName | string | `""` | sessionBrowserName if the browserName is different from the sessionBrowserName | | relayNode.hpa.browserVersion | string | `""` | browserVersion should match with Node stereotype and request capability is scaled by this scaler | | relayNode.hpa.platformName | string | `"Android"` | platformName should match with Node stereotype and request capability is scaled by this scaler | -| relayNode.hpa.capabilities | string | `""` | Setting more custom capabilities for matching specific Nodes | | relayNode.hpa.unsafeSsl | string | `"{{ template \"seleniumGrid.graphqlURL.unsafeSsl\" . }}"` | Skip check SSL when connecting to the Graphql endpoint | | relayNode.initContainers | list | `[]` | It is used to add initContainers in the same pod of the browser node. It should be set using the --set-json option | | relayNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option | diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index a781fa981f..fbc286d112 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -209,6 +209,7 @@ Common autoscaling spec template {{- $spec := toYaml (dict) -}} {{- $nodeMaxSessions := default $.Values.global.seleniumGrid.nodeMaxSessions .node.nodeMaxSessions | int64 -}} {{- $nodeEnableManagedDownloads := default $.Values.global.seleniumGrid.nodeEnableManagedDownloads .node.nodeEnableManagedDownloads -}} +{{- $nodeCustomCapabilities := default $.Values.global.seleniumGrid.nodeCustomCapabilities .node.nodeCustomCapabilities -}} {{/* Merge with precedence from right to left */}} {{- with $.Values.autoscaling.scaledOptions -}} {{- $spec = mergeOverwrite ($spec | fromYaml) . | toYaml -}} @@ -249,6 +250,9 @@ triggers: {{- if not .enableManagedDownloads }} enableManagedDownloads: {{ $nodeEnableManagedDownloads | quote }} {{- end }} + {{- if not .capabilities }} + capabilities: {{ $nodeCustomCapabilities | quote }} + {{- end }} {{- end }} authenticationRef: name: {{ template "seleniumGrid.autoscaling.authenticationRef.fullname" $ }} @@ -289,6 +293,7 @@ Common pod template {{- $videoImageTag := default $.Values.global.seleniumGrid.videoImageTag .recorder.imageTag -}} {{- $nodeMaxSessions := default $.Values.global.seleniumGrid.nodeMaxSessions .node.nodeMaxSessions | int64 -}} {{- $nodeEnableManagedDownloads := default $.Values.global.seleniumGrid.nodeEnableManagedDownloads .node.nodeEnableManagedDownloads -}} +{{- $nodeCustomCapabilities := default $.Values.global.seleniumGrid.nodeCustomCapabilities .node.nodeCustomCapabilities -}} {{- $nodeRegisterPeriod := default $.Values.global.seleniumGrid.nodeRegisterPeriod .node.nodeRegisterPeriod | int64 -}} {{- $nodeRegisterCycle := default $.Values.global.seleniumGrid.nodeRegisterCycle .node.nodeRegisterCycle | int64 -}} template: @@ -360,6 +365,8 @@ template: {{- end }} - name: SE_NODE_ENABLE_MANAGED_DOWNLOADS value: {{ $nodeEnableManagedDownloads | quote }} + - name: SE_NODE_STEREOTYPE_EXTRA + value: {{ $nodeCustomCapabilities | quote }} - name: SE_DRAIN_AFTER_SESSION_COUNT value: {{ and (eq (include "seleniumGrid.useKEDA" $) "true") (eq .Values.autoscaling.scalingType "job") | ternary $nodeMaxSessions 0 | quote }} {{- if and (eq (include "seleniumGrid.useKEDA" $) "true") }} @@ -369,10 +376,6 @@ template: {{- if and (eq (include "seleniumGrid.useKEDA" $) "true") }} - name: SE_NODE_PLATFORM_NAME value: {{ if hasKey .node.hpa "platformName" }}{{ .node.hpa.platformName | quote }}{{ else }}""{{ end }} - {{- end }} - {{- if and (eq (include "seleniumGrid.useKEDA" $) "true") }} - - name: SE_NODE_STEREOTYPE_EXTRA - value: {{ if hasKey .node.hpa "capabilities" }}{{ .node.hpa.capabilities | quote }}{{ else }}""{{ end }} {{- end }} - name: SE_NODE_CONTAINER_NAME valueFrom: diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index f52f8ae6ee..51a91181e9 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -52,6 +52,8 @@ global: nodeMaxSessions: 1 # -- This causes the Node to auto manage files downloaded for a given session on the Node (https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#enable-downloads-in-the-grid) nodeEnableManagedDownloads: false + # -- Setting custom capabilities for matching specific Nodes (https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes) + nodeCustomCapabilities: "" # -- How long, in seconds, will the Node try to register to the Distributor for the first time. After this period is completed, the Node will not attempt to register again. nodeRegisterPeriod: 120 # -- How often, in seconds, the Node will try to register itself for the first time to the Distributor. @@ -1268,6 +1270,8 @@ chromeNode: # -- Override the managed downloads in node nodeEnableManagedDownloads: # -- Override the same config at the global level + nodeCustomCapabilities: "" + # -- Override the same config at the global level nodeRegisterPeriod: # -- Override the same config at the global level nodeRegisterCycle: @@ -1286,9 +1290,6 @@ chromeNode: browserVersion: "" # -- platformName should match with Node stereotype and request capability is scaled by this scaler platformName: "" - # -- Setting more custom capabilities for matching specific Nodes - capabilities: "" - # browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid. # -- Skip check SSL when connecting to the Graphql endpoint unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional @@ -1465,6 +1466,8 @@ firefoxNode: # -- Override the managed downloads in node nodeEnableManagedDownloads: # -- Override the same config at the global level + nodeCustomCapabilities: "" + # -- Override the same config at the global level nodeRegisterPeriod: # -- Override the same config at the global level nodeRegisterCycle: @@ -1483,8 +1486,6 @@ firefoxNode: browserVersion: "" # -- platformName should match with Node stereotype and request capability is scaled by this scaler platformName: "" - # -- Setting more custom capabilities for matching specific Nodes - capabilities: "" # -- Skip check SSL when connecting to the Graphql endpoint unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional @@ -1661,6 +1662,8 @@ edgeNode: # -- Override the managed downloads in node nodeEnableManagedDownloads: # -- Override the same config at the global level + nodeCustomCapabilities: "" + # -- Override the same config at the global level nodeRegisterPeriod: # -- Override the same config at the global level nodeRegisterCycle: @@ -1679,8 +1682,6 @@ edgeNode: browserVersion: "" # -- platformName should match with Node stereotype and request capability is scaled by this scaler platformName: "" - # -- Setting more custom capabilities for matching specific Nodes - capabilities: "" # -- Skip check SSL when connecting to the Graphql endpoint unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional @@ -1857,6 +1858,8 @@ relayNode: # -- Override the managed downloads in node nodeEnableManagedDownloads: # -- Override the same config at the global level + nodeCustomCapabilities: "" + # -- Override the same config at the global level nodeRegisterPeriod: # -- Override the same config at the global level nodeRegisterCycle: @@ -1875,8 +1878,6 @@ relayNode: browserVersion: "" # -- platformName should match with Node stereotype and request capability is scaled by this scaler platformName: "Android" - # -- Setting more custom capabilities for matching specific Nodes - capabilities: "" # -- Skip check SSL when connecting to the Graphql endpoint unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional diff --git a/tests/charts/make/chart_test.sh b/tests/charts/make/chart_test.sh index 2be142ac1c..fa9fed7f59 100755 --- a/tests/charts/make/chart_test.sh +++ b/tests/charts/make/chart_test.sh @@ -66,6 +66,7 @@ TEST_EXISTING_PTS=${TEST_EXISTING_PTS:-"false"} TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS:-"false"} TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT:-"true"} TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS:-"false"} +TEST_CUSTOM_SPECIFIC_NAME=${TEST_CUSTOM_SPECIFIC_NAME:-"false"} wait_for_terminated() { # Wait until no pods are in "Terminating" state @@ -187,6 +188,12 @@ if [ -n "${TRACING_EXPORTER_ENDPOINT}" ]; then " fi +if [ "${TEST_CUSTOM_SPECIFIC_NAME}" = "true" ]; then + HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ + --set global.seleniumGrid.nodeCustomCapabilities={'myApp:version':'beta','myApp:publish':'public'} \ + " +fi + if [ "${SELENIUM_GRID_AUTOSCALING}" = "true" ] && [ "${TEST_EXISTING_KEDA}" = "true" ]; then HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ --set autoscaling.enabled=false \ @@ -497,6 +504,7 @@ export TEST_AUTOSCALING_ITERATIONS=${TEST_AUTOSCALING_ITERATIONS:-"20"} export TEST_MULTIPLE_VERSIONS=${TEST_MULTIPLE_VERSIONS} export TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT} export TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS} +export TEST_CUSTOM_SPECIFIC_NAME=${TEST_CUSTOM_SPECIFIC_NAME} if [ "${MATRIX_BROWSER}" = "NoAutoscaling" ]; then ./tests/bootstrap.sh NodeFirefox if [ "${TEST_PLATFORMS}" = "linux/amd64" ]; then diff --git a/tests/charts/templates/render/dummy.yaml b/tests/charts/templates/render/dummy.yaml index 72a8eae518..25eccbe178 100644 --- a/tests/charts/templates/render/dummy.yaml +++ b/tests/charts/templates/render/dummy.yaml @@ -18,6 +18,8 @@ global: topologyKey: kubernetes.io/hostname whenUnsatisfiable: DoNotSchedule nodeMaxSessions: 3 + nodeEnableManagedDownloads: true + nodeCustomCapabilities: "{'myApp:version':'beta','myApp:publish':'public'}" monitoring: enabledWithExistingAgent: true diff --git a/tests/charts/templates/render/dummy_solution.yaml b/tests/charts/templates/render/dummy_solution.yaml index 42dcda47e4..82a951a297 100644 --- a/tests/charts/templates/render/dummy_solution.yaml +++ b/tests/charts/templates/render/dummy_solution.yaml @@ -18,6 +18,8 @@ global: topologyKey: kubernetes.io/hostname whenUnsatisfiable: DoNotSchedule nodeMaxSessions: 3 + nodeEnableManagedDownloads: true + nodeCustomCapabilities: "{'myApp:version':'beta','myApp:publish':'public'}" selenium-grid: autoscaling: