Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .keda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ You can involve to review and discuss the pull requests to help us early detect

[kedacore/keda](https://github.com/kedacore/keda)

- https://github.com/kedacore/keda/pull/6477
- https://github.com/kedacore/keda/pull/6536 (plan, v2.17.0)

- https://github.com/kedacore/keda/pull/6477 (plan, v2.17.0)

- ~~https://github.com/kedacore/keda/pull/6437 (merged, v2.16.1)~~

Expand All @@ -59,9 +61,11 @@ You can involve to review and discuss the pull requests to help us early detect

[kedacore/keda-docs](https://github.com/kedacore/keda-docs)

- https://github.com/kedacore/keda-docs/pull/1522
- https://github.com/kedacore/keda-docs/pull/1533 (plan, v2.17.0)

- https://github.com/kedacore/keda-docs/pull/1522 (plan, v2.17.0)

- https://github.com/kedacore/keda-docs/pull/1515
- ~~https://github.com/kedacore/keda-docs/pull/1515 (merged, v2.16.1)~~

- ~~https://github.com/kedacore/keda-docs/pull/1468 (merged, v2.16.0)~~

Expand Down
82 changes: 73 additions & 9 deletions .keda/scalers/selenium-grid-scaler.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ triggers:
browserName: '' # Optional. Required to be matched with the request in queue and Node stereotypes (Similarly for `browserVersion` and `platformName`).
browserVersion: '' # Optional.
platformName: '' # Optional.
unsafeSsl : 'false' # Optional.
unsafeSsl: 'false' # Optional.
activationThreshold: 0 # Optional.
```

Expand All @@ -37,6 +37,7 @@ triggers:
- `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. (Optional)
- `nodeMaxSessions` - Number of maximum sessions that can run in parallel on a Node. Update this parameter align with node config `--max-sessions` (`SE_NODE_MAX_SESSIONS`) to have the correct scaling behavior. (Default: `1`, Optional).
- `capabilities` - Add more custom capabilities for matching specific Nodes. (Optional)

**Trigger Authentication**
- `username` - Username for basic authentication in GraphQL endpoint instead of embedding in the URL. (Optional)
Expand Down Expand Up @@ -88,7 +89,7 @@ spec:
url: 'http://selenium-hub:4444/graphql'
browserName: 'chrome'
platformName: 'Linux'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

Noted:
Expand Down Expand Up @@ -198,7 +199,7 @@ spec:
browserName: 'chrome'
platformName: 'Linux'
browserVersion: '131.0'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

The request to trigger this scaler should be
Expand All @@ -210,6 +211,69 @@ options.set_capability('browserVersion', '131.0')
driver = webdriver.Remote(options=options, command_executor=SELENIUM_GRID_URL)
```

For an advanced use case, you also can set custom capabilities for matching specific Nodes in the scaler trigger metadata. For example

```yaml
kind: Deployment
metadata:
name: selenium-node-chrome
labels:
deploymentName: selenium-node-chrome
spec:
replicas: 1
template:
spec:
containers:
- name: selenium-node-chrome
image: selenium/node-chrome:132.0
ports:
- containerPort: 5555
env:
- name: SE_NODE_BROWSER_VERSION
value: '132.0'
- name: SE_NODE_PLATFORM_NAME
value: 'Linux'
# Append custom capabilities to Node stereotype. See: https://github.com/SeleniumHQ/docker-selenium?tab=readme-ov-file#node-configuration-options
- name: SE_NODE_STEREOTYPE_EXTRA
value: "{\"myApp:version\":\"beta\", \"myApp:publish:\":\"public\"}"

---

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: selenium-grid-scaledobject-chrome-132
namespace: keda
labels:
deploymentName: selenium-node-chrome-132
spec:
maxReplicaCount: 8
scaleTargetRef:
name: selenium-node-chrome-132
triggers:
- type: selenium-grid
metadata:
url: 'http://selenium-hub:4444/graphql'
browserName: 'chrome'
platformName: 'Linux'
browserVersion: '132.0'
unsafeSsl: 'true'
# Add custom capabilities for matching specific Nodes in scaler trigger metadata. See: https://github.com/kedacore/keda/pull/6536
capabilities: "{\"myApp:version\":\"beta\", \"myApp:publish:\":\"public\"}"
```

The request to trigger this scaler should be

```python
options = ChromeOptions()
options.set_capability('platformName', 'Linux')
options.set_capability('browserVersion', '132.0')
# Add custom capabilities for matching specific Nodes in client binding. See: https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes
options.set_capability('myApp:version', 'beta')
options.set_capability('myApp:publish', 'public')
driver = webdriver.Remote(options=options, command_executor=SELENIUM_GRID_URL)
```

Similarly, for Firefox

```yaml
Expand All @@ -230,7 +294,7 @@ spec:
url: 'http://selenium-hub:4444/graphql'
browserName: 'firefox'
platformName: 'Linux'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

Request to trigger the scaler
Expand Down Expand Up @@ -262,7 +326,7 @@ spec:
browserName: 'MicrosoftEdge'
sessionBrowserName: 'msedge'
platformName: 'Linux'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

Request to trigger the scaler
Expand Down Expand Up @@ -294,7 +358,7 @@ spec:
browserName: 'chrome'
platformName: 'Linux'
nodeMaxSessions: 4
unsafeSsl : 'true'
unsafeSsl: 'true'
```

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.
Expand All @@ -318,7 +382,7 @@ spec:
browserName: 'chrome'
platformName: 'Linux'
browserVersion: '91.0'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

```yaml
Expand All @@ -340,7 +404,7 @@ spec:
browserName: 'chrome'
platformName: 'Linux'
browserVersion: '90.0'
unsafeSsl : 'true'
unsafeSsl: 'true'
```

### Authentication Parameters
Expand Down Expand Up @@ -396,7 +460,7 @@ spec:
metadata:
browserName: 'chrome'
platformName: 'Linux'
unsafeSsl : 'true'
unsafeSsl: 'true'
authenticationRef:
name: keda-trigger-auth-selenium-grid-secret
```
Loading
Loading