Skip to content

Commit

Permalink
Added documentation for new selenium grid scaler (kedacore#491)
Browse files Browse the repository at this point in the history
Signed-off-by: prashanth <[email protected]>

Co-authored-by: prashanth <[email protected]>
Co-authored-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2021
1 parent 61254b4 commit b29f45e
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions content/docs/2.4/scalers/selenium-grid-scaler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
+++
title = "Selenium Grid Scaler"
availability = "v2.4+"
maintainer = "Volvo Cars"
description = "Scales Selenium browser nodes based on number of requests waiting in session queue"
layout = "scaler"
go_file = "selenium_grid_scaler"
+++

### Trigger Specification

This specification describes the `selenium-grid` trigger that scales browser nodes based on number of requests in session queue.

The scaler creates one browser node per pending request in session queue. You will have to create one trigger per browser capability that you would like to support in your Selenium Grid.

The below is an example trigger configuration for chrome node.

```yaml
triggers:
- type: selenium-grid
metadata:
url: 'http://selenium-hub:4444/graphql' # Required
browserName: 'chrome' # Required
browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid.
```
**Parameter list:**
- `url` is graphql url of your Selenium Grid. Refer to the Selenium Grid's documentation [here](https://www.selenium.dev/documentation/en/grid/grid_4/graphql_support/) to for more info.
- `browserName` is the 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.
- `browserVersion` is the version of browser that usually gets passed in the browser capability. This is an optional param and you can ignore it if you are running only one single version of every 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.

### Example

Here is a full example of scaled object definition using Selenium Grid trigger:

```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'
```

The above example will create Chrome browser nodes equal to the requests pending in session queue for Chrome browser.

Similary for Firefox

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: selenium-grid-firefox-scaledobject
namespace: keda
labels:
deploymentName: selenium-firefox-node
spec:
maxReplicaCount: 8
scaleTargetRef:
name: selenium-firefox-node
triggers:
- type: selenium-grid
metadata:
url: 'http://selenium-hub:4444/graphql'
browserName: 'firefox'
```

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
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: selenium-grid-chrome-91-scaledobject
namespace: keda
labels:
deploymentName: selenium-chrome-node-91
spec:
maxReplicaCount: 8
scaleTargetRef:
name: selenium-chrome-node-91
triggers:
- type: selenium-grid
metadata:
url: 'http://selenium-hub:4444/graphql'
browserName: 'chrome'
browserVersion: '91.0'
```

```yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: selenium-grid-chrome-90-scaledobject
namespace: keda
labels:
deploymentName: selenium-chrome-node-90
spec:
maxReplicaCount: 8
scaleTargetRef:
name: selenium-chrome-node-90
triggers:
- type: selenium-grid
metadata:
url: 'http://selenium-hub:4444/graphql'
browserName: 'chrome'
browserVersion: '90.0'
```

0 comments on commit b29f45e

Please sign in to comment.