From e735935d3173b7fb1f012f4011185d0a493ce956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Hanzl=C3=ADk?= Date: Wed, 16 Oct 2024 18:53:45 +0200 Subject: [PATCH] extend selenium-grid scaler (#1449) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * describe sessionsPerNode and setSessionsFromHub parameters for selenium-grid scaler Signed-off-by: Hanzlik, Robert (MONETA) * document sessionBrowserVersion Signed-off-by: Hanzlik, Robert (MONETA) * Update content/docs/2.16/scalers/selenium-grid-scaler.md fix typo Co-authored-by: Jorge Turrado Ferrero Signed-off-by: Robert Hanzlík Signed-off-by: Hanzlik, Robert (MONETA) --------- Signed-off-by: Hanzlik, Robert (MONETA) Signed-off-by: Robert Hanzlík Co-authored-by: Jorge Turrado Ferrero --- .../docs/2.16/scalers/selenium-grid-scaler.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/content/docs/2.16/scalers/selenium-grid-scaler.md b/content/docs/2.16/scalers/selenium-grid-scaler.md index 583ae6995..05b3cc5dc 100644 --- a/content/docs/2.16/scalers/selenium-grid-scaler.md +++ b/content/docs/2.16/scalers/selenium-grid-scaler.md @@ -33,9 +33,12 @@ triggers: - `browserName` - Name of browser that usually gets passed in the browser capability. Refer to the [Selenium Grid's](https://www.selenium.dev/documentation/en/getting_started_with_webdriver/browsers/) and [WebdriverIO's](https://webdriver.io/docs/options/#capabilities) documentation for more info. - `sessionBrowserName` - Name of the browser when it is an active session, only set if `BrowserName` changes between the queue and the active session. See the Edge example below for further detail. (Optional) - `browserVersion` - Version of browser that usually gets passed in the browser capability. Refer to the [Selenium Grid's](https://www.selenium.dev/documentation/en/getting_started_with_webdriver/browsers/) and [WebdriverIO's](https://webdriver.io/docs/options/#capabilities) documentation for more info. (Optional) +- `sessionBrowserVersion` - Version of the browser when it is an active session, only set, when scaling without defined exact `browserVersion`. - `unsafeSsl` - Skip certificate validation when connecting over HTTPS. (Values: `true`, `false`, Default: `false`, Optional) - `activationThreshold` - Target value for activating the scaler. Learn more about activation [here](./../concepts/scaling-deployments.md#activating-and-scaling-thresholds). (Default: `0`, Optional) - `platformName` - Name of the browser platform. Refer to the [Selenium Grid's](https://www.selenium.dev/documentation/en/getting_started_with_webdriver/browsers/) and [WebdriverIO's](https://webdriver.io/docs/options/#capabilities) documentation for more info. (Default: `Linux`, Optional) +- `setSessionsFromHub` - When set, count number of browser node slots and sessions from existing nodes, use this data for scaling. (Default: `false`, Optional) +- `sessionsPerNode` - Use as default number of sessions per browser node, when none are found existing on selenium grid. (Default: `1`, Optional) ### Example @@ -105,6 +108,29 @@ spec: sessionBrowserName: 'msedge' ``` +If your selenium browser nodes are not exactly same and you wanna to scale them based on real `slots` settings, set `setSessionsFromHub` to `true` and `sessionsPerNode` to real number of slots, if you wanna scale from 0. + +```yaml +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: selenium-grid-chrome-scaledobject + namespace: keda + labels: + deploymentName: selenium-chrome-node +spec: + maxReplicaCount: 8 + scaleTargetRef: + name: selenium-chrome-node + triggers: + - type: selenium-grid + metadata: + url: 'http://selenium-hub:4444/graphql' + browserName: 'chrome' + setSessionsFromHub: 'true' + sessionsPerNode: 4 +``` + If you are supporting multiple versions of browser capability in your Selenium Grid, You should create one scaler for every browser version and pass the `browserVersion` in the metadata. ```yaml