Skip to content

Commit

Permalink
Merge branch 'main' into fix-cloudwatch-metrics-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolajv authored Nov 4, 2024
2 parents 65aacca + 5f6f155 commit 3c902f3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 26 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Adapted from @chalin's work on https://github.com/chalin/docsy-starter

name: Links

on:
merge_group:
pull_request:
push: { branches: [main] }

jobs:
build-and-check-links:
name: BUILD and CHECK LINKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create NPM cache-hash input file
run: |
mkdir -p tmp
jq '{devDependencies, engines, gitHubActionCacheKey}' package.json > tmp/package-ci.json
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: tmp/package-ci.json

- run: npm install --omit=optional

- run: npm run check:links
35 changes: 17 additions & 18 deletions content/docs/2.16/scalers/selenium-grid-scaler.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
+++
title = "Selenium Grid Scaler"
availability = "v2.4+"
maintainer = "Volvo Cars"
maintainer = "Volvo Cars, SeleniumHQ"
category = "Testing"
description = "Scales Selenium browser nodes based on number of requests waiting in session queue"
go_file = "selenium_grid_scaler"
Expand Down Expand Up @@ -29,16 +29,20 @@ triggers:
**Parameter list:**
- `url` - 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.
- `url` - 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. If endpoint requires authentication, you can use `TriggerAuthentication` to provide the credentials instead of embedding in the URL.
- `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)
- `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).

**Trigger Authentication**
- `username` - Username for basic authentication in GraphQL endpoint instead of embedding in the URL. (Optional)
- `password` - Password for basic authentication in GraphQL endpoint instead of embedding in the URL. (Optional)
- `authType` - Type of authentication to be used. This can be set to `Bearer` or `OAuth2` in case Selenium Grid behind an Ingress proxy with other authentication types. (Optional)
- `accessToken` - Access token. This is required when `authType` is set a value. (Optional)

### Example

Expand Down Expand Up @@ -108,7 +112,7 @@ 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.
In case you want to scale from 0 (`minReplicaCount: 0`), and browser nodes are configured different `--max-sessions` greater than 1, you can set `nodeMaxSessions` for scaler align with number of slots available per node to have the correct scaling behavior.

```yaml
apiVersion: keda.sh/v1alpha1
Expand All @@ -127,8 +131,7 @@ spec:
metadata:
url: 'http://selenium-hub:4444/graphql'
browserName: 'chrome'
setSessionsFromHub: 'true'
sessionsPerNode: 4
nodeMaxSessions: 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.
Expand Down Expand Up @@ -178,11 +181,8 @@ spec:
It is possible to specify the Graphql url of your Selenium Grid using authentication parameters. This useful if you have enabled Selenium Grid's Basic HTTP Authentication and would like to keep your credentials secure.

- `url` - 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/) for more info.

As an alternative you can also authenticate by using username and password via `TriggerAuthentication` configuration instead of using url.

- `username` - Username for connect to the Selenium Grid graphql endpoint.
- `password` - Password for connect to the Selenium Grid graphql endpoint.
- `username` - Username for basic authentication in GraphQL endpoint instead of embedding in the URL. (Optional)
- `password` - Password for basic authentication in GraphQL endpoint instead of embedding in the URL. (Optional)

```yaml
apiVersion: v1
Expand All @@ -193,9 +193,8 @@ metadata:
type: Opaque
data:
graphql-url: base64 encoded value of GraphQL URL
# or use username and password separately
grid-username: GRID_USERNAME
grid-password: GRID_PASSWORD
graphql-username: base64 encoded value of GraphQL Username
graphql-password: base64 encoded value of GraphQL Password
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
Expand All @@ -209,10 +208,10 @@ spec:
key: graphql-url
- parameter: username
name: selenium-grid-secret
key: grid-username
key: graphql-username
- parameter: password
name: selenium-grid-secret
key: grid-password
key: graphql-password
---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
"scripts": {
"_build": "hugo --cleanDestinationDir -e dev -DFE",
"_check-links": "make check-links",
"__check:links": "make --keep-going check-links",
"_check:links": "HTMLTEST_ARGS='--log-level 1 --skip-external' npm run __check:links",
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_serve:hugo": "hugo serve -DFE --minify",
"_serve": "netlify dev -c \"npm run _serve:hugo\" --framework hugo",
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
"build:production": "hugo --cleanDestinationDir --minify",
"build": "npm run _build",
"check-links:all": "HTMLTEST_ARGS= npm run _check-links",
"check-links": "npm run _check-links",
"check:links:all": "HTMLTEST_ARGS= npm run _check:links",
"check:links": "npm run _check:links",
"clean": "make clean",
"postbuild:preview": "npm run _check-links",
"postbuild:production": "npm run _check-links",
"precheck-links:all": "npm run build",
"precheck-links": "npm run build",
"postbuild:preview": "npm run _check:links--warn",
"postbuild:production": "npm run _check:links--warn",
"precheck:links:all": "npm run build",
"precheck:links": "npm run build",
"serve:hugo": "npm run _serve:hugo",
"serve": "npm run _serve",
"test": "npm run check-links"
"test": "npm run check:links"
},
"devDependencies": {
"bulma": "^0.8.2",
Expand Down

0 comments on commit 3c902f3

Please sign in to comment.