Skip to content

Commit 4c61f38

Browse files
VietND96claude
andauthored
K8s: Replace external scaler jobScalingStrategy with includeOngoingSessions (#3218)
* K8s: Replace external scaler jobScalingStrategy with includeOngoingSessions Aligns the Selenium Grid KEDA external scaler with the trigger param merged into the built-in scaler upstream (kedacore/keda#8107), so the two implementations stay a mechanical swap of trigger `type`. The external scaler previously took `jobScalingStrategy` (default|custom|accurate|eager) and derived the count convention from it. Upstream settled on a plain boolean instead, matching how other scalers expose the same choice (SQS `scaleOnInFlight`, RabbitMQ `excludeUnacknowledged`, Beanstalkd `includeDelayed`, Temporal `includeRunningWorkflowCount`). - metadata: `JobScalingStrategy string` -> `IncludeOngoingSessions bool` (default true); enum validation replaced by strconv.ParseBool. - server: scrapeAndCount adds onGoingSessions only when the flag is set, matching upstream GetMetricsAndActivity. - chart: `_helpers.tpl` derives `includeOngoingSessions` from `autoscaling.scaledJobOptions.scalingStrategy.strategy` - false for `accurate`/`eager`, true otherwise. Override key is now `<node>.hpa.includeOngoingSessions`. The chart default strategy is `accurate`, so the default render now emits "false", which is the fix for the runaway Node creation in #3167. `jobScalingStrategy` is removed rather than deprecated; it only ever existed on the external scaler and never reached the built-in one. Note the patched built-in scaler copy in `.keda/scalers/` is deliberately left tracking upstream main; it picks the param up when #8107 merges. Relates to #3167 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hwsdd5D5hWWXiPJ1hdPBzh * K8s: Point scale test's previous-version Nodes at GHCR Previous-version Nodes in the TEST_MULTIPLE_VERSIONS scale test pulled from Docker Hub, which hits the anonymous pull rate limit when a scale test brings many of them up at once (observed in https://github.com/SeleniumHQ/docker-selenium/actions/runs/33747779946/attempts/2). Rather than editing charts/selenium-grid/multiple-nodes-platform-version.yaml - shipped chart documentation/example content that should stay on the default (Docker Hub) registry for real users - control this from tests/: - Add tests/charts/ci/multiple-nodes-platform-version-values.yaml, a test-only overlay that pins previous-version Nodes to ghcr.io/seleniumhq (anonymous, unmetered for public images). - Prune its version range to what tests/SeleniumTests/__init__.py actually requests (LIST_CHROMIUM_VERSIONS / LIST_FIREFOX_VERSIONS = 144.0-147.0), instead of mirroring the shipped file's full historical list. Versions outside that range never receive a session request during the test, so they never scale up and never pull an image anyway; keeping them only added scaler triggers with no coverage benefit. - Point chart_test.sh's TEST_MULTIPLE_VERSIONS branch at this overlay instead of the chart's file. All ten pinned tags (chrome/edge 144-146, firefox 144-147, each -20260808) were confirmed present on ghcr.io/seleniumhq before this change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hwsdd5D5hWWXiPJ1hdPBzh * K8s: Bump test matrix K8s/Helm versions by one minor release Rolling maintenance bump: every k8s-version and helm-version entry across the K8s test matrices advances by one minor release, each to its latest published patch: k8s: 1.29->1.30, 1.30->1.31, 1.31->1.32, 1.32->1.33, 1.33->1.34, 1.34->1.35 helm: 3.14->3.15, 3.15->3.16, 3.16->3.17, 3.17->3.18, 3.18->3.19, 3.19->3.20, 4.0->4.1 Applies to helm-chart-test.yml, k8s-scaling-test.yml, and k8s-dynamic-grid-test.yml (k8s-version only, no helm-version there). docker-version/python-version are untouched. Note: this does not fully clear the isCIDR/Calico CRD failure seen on https://github.com/SeleniumHQ/docker-selenium/actions/runs/33747779946/attempts/2 - job_https now lands on k8s v1.30.14, the same version that failed as job_hostname before this bump (v1.31.14 is the confirmed-working floor for Calico's current CRD). Tracked as a separate follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hwsdd5D5hWWXiPJ1hdPBzh * K8s: Test both default and accurate ScaledJob strategies, hard-fail on pod-count mismatch Scale testing only ever exercised the "default" ScaledJob strategy, even though the shipped chart default is "accurate" - the exact strategy #3167 and the includeOngoingSessions fix (PR #3218) target. Add matching coverage, and turn the existing (unused) pod-count check into a real assertion instead of a warn-only log. Makefile: - Add test_k8s_autoscaling_job_count_strategy_accurate(_in_chaos| _with_node_max_sessions), mirroring the "default" targets by reusing test_k8s_autoscaling_job_count_strategy_default with SCALING_STRATEGY=accurate (already forwarded to autoscaling.scaledJobOptions.scalingStrategy.strategy by chart_test.sh - no new plumbing needed). .github/workflows/k8s-scaling-test.yml: - Add 3 matrix entries for the new "accurate" targets, each pinned to the same k8s/helm/docker/python versions as its "default" counterpart so a difference in results reflects the strategy, not the environment. tests/AutoscalingTests/common.py: - wait_for_count_matches() was dead code (never called) and, even if called, only warned on mismatch. It also compared pod count to raw session count, which is wrong once sessions span multiple browser types Chrome/Firefox/Edge scale independently, so the correct expected count is the sum of per-browser ceil(sessions/node_max_sessions), not one ceiling over the total. - Rewritten to compute that per-browser expected count and raise AssertionError immediately if the poll times out without matching - a hard failure, not a log line. This makes it a direct regression guard for #3167: a strategy that double-counts on-going sessions never converges pod count to the expected value, so the poll times out and the test fails. - create_session/create_sessions_in_parallel now track (driver, browser_name) tuples so per-browser counts are available; close_all_sessions/randomly_quit_sessions updated accordingly. tests/AutoscalingTests/test_scale_up.py, test_scale_chaos.py: - Call wait_for_count_matches(SESSIONS, TEST_NODE_MAX_SESSIONS) right after each iteration's scale-up, before the next create/quit cycle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hwsdd5D5hWWXiPJ1hdPBzh * K8s: Fix job_https Setup Kubernetes cluster failure (Calico isCIDR) https://github.com/SeleniumHQ/docker-selenium/actions/runs/33781949421/job/100765325753 Confirms the residual risk flagged in 55011ea: after the +1 minor bump, job_https landed on k8s v1.30.14 - the same version that failed as job_hostname before that bump. Calico's ClusterNetworkPolicy CRD uses the CEL builtin isCIDR(self), which v1.30's CEL library doesn't support ("undeclared reference to 'isCIDR'"), so `minikube start` fails applying the CNI manifest every retry. Move job_https to v1.31.14 (matching helm v3.16.4) - the confirmed working floor, since job_hostname already runs there successfully. Every k8s-version across all three workflows is now >= v1.31.14. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hwsdd5D5hWWXiPJ1hdPBzh --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 1d1cf83 commit 4c61f38

22 files changed

Lines changed: 317 additions & 129 deletions

‎.github/workflows/helm-chart-test.yml‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,79 +49,79 @@ jobs:
4949
fail-fast: false
5050
matrix:
5151
include:
52-
- k8s-version: 'v1.34.2'
52+
- k8s-version: 'v1.35.8'
5353
cluster: 'minikube'
54-
helm-version: 'v3.19.2'
54+
helm-version: 'v3.20.2'
5555
docker-version: '29.1.1'
5656
python-version: '3.10'
5757
test-upgrade: true
5858
service-mesh: false
5959
os: ubuntu-22.04
6060
check-records-output: true
6161
test-strategy: disabled
62-
- k8s-version: 'v1.34.2'
62+
- k8s-version: 'v1.35.8'
6363
cluster: 'minikube'
64-
helm-version: 'v3.18.6'
64+
helm-version: 'v3.19.5'
6565
docker-version: '29.1.1'
6666
python-version: '3.10'
6767
test-upgrade: true
6868
service-mesh: false
6969
os: ubuntu-22.04
7070
check-records-output: true
7171
test-strategy: job
72-
- k8s-version: 'v1.34.2'
72+
- k8s-version: 'v1.35.8'
7373
cluster: 'minikube'
74-
helm-version: 'v4.0.1'
74+
helm-version: 'v4.1.4'
7575
docker-version: '29.1.1'
7676
python-version: '3.14'
7777
test-upgrade: true
7878
service-mesh: true
7979
os: ubuntu-22.04
8080
check-records-output: true
8181
test-strategy: deployment
82-
- k8s-version: 'v1.29.15'
82+
- k8s-version: 'v1.31.14'
8383
cluster: 'minikube'
84-
helm-version: 'v3.14.3'
84+
helm-version: 'v3.16.4'
8585
docker-version: '27.5.1'
8686
python-version: '3.11'
8787
test-upgrade: true
8888
service-mesh: false
8989
os: ubuntu-22.04
9090
check-records-output: true
9191
test-strategy: job_https
92-
- k8s-version: 'v1.30.14'
92+
- k8s-version: 'v1.31.14'
9393
cluster: 'minikube'
94-
helm-version: 'v3.15.4'
94+
helm-version: 'v3.16.4'
9595
docker-version: '27.5.1'
9696
python-version: '3.12'
9797
test-upgrade: true
9898
service-mesh: false
9999
os: ubuntu-22.04
100100
check-records-output: true
101101
test-strategy: job_hostname
102-
- k8s-version: 'v1.31.14'
102+
- k8s-version: 'v1.32.13'
103103
cluster: 'minikube'
104-
helm-version: 'v3.16.4'
104+
helm-version: 'v3.17.4'
105105
docker-version: '27.5.1'
106106
python-version: '3.13'
107107
test-upgrade: true
108108
service-mesh: false
109109
os: ubuntu-22.04
110110
check-records-output: true
111111
test-strategy: deployment_https
112-
- k8s-version: 'v1.32.10'
112+
- k8s-version: 'v1.33.13'
113113
cluster: 'minikube'
114-
helm-version: 'v3.17.4'
114+
helm-version: 'v3.18.6'
115115
docker-version: '28.5.2'
116116
python-version: '3.10'
117117
test-upgrade: true
118118
service-mesh: false
119119
os: ubuntu-22.04
120120
check-records-output: true
121121
test-strategy: playwright_connect_grid
122-
- k8s-version: 'v1.32.10'
122+
- k8s-version: 'v1.33.13'
123123
cluster: 'minikube'
124-
helm-version: 'v3.18.6'
124+
helm-version: 'v3.19.5'
125125
docker-version: '28.5.2'
126126
python-version: '3.10'
127127
test-upgrade: true

‎.github/workflows/k8s-dynamic-grid-test.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
fail-fast: false
2727
matrix:
2828
include:
29-
- k8s-version: 'v1.34.2'
29+
- k8s-version: 'v1.35.8'
3030
cluster: 'minikube'
3131
docker-version: '29.1.1'
3232
python-version: '3.10'
3333
os: ubuntu-22.04
3434
mode: standalone
35-
- k8s-version: 'v1.34.2'
35+
- k8s-version: 'v1.35.8'
3636
cluster: 'minikube'
3737
docker-version: '29.1.1'
3838
python-version: '3.10'

‎.github/workflows/k8s-scaling-test.yml‎

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,44 +71,65 @@ jobs:
7171
fail-fast: false
7272
matrix:
7373
include:
74-
- k8s-version: 'v1.34.2'
74+
- k8s-version: 'v1.35.8'
7575
cluster: 'minikube'
76-
helm-version: 'v4.0.1'
76+
helm-version: 'v4.1.4'
7777
docker-version: '29.1.1'
7878
python-version: '3.13'
7979
os: ubuntu-22.04
8080
test-strategy: test_k8s_autoscaling_job_count_strategy_default_in_chaos
81-
- k8s-version: 'v1.34.2'
81+
- k8s-version: 'v1.35.8'
8282
cluster: 'minikube'
83-
helm-version: 'v3.19.2'
83+
helm-version: 'v3.20.2'
8484
docker-version: '29.1.1'
8585
python-version: '3.13'
8686
os: ubuntu-22.04
8787
test-strategy: test_k8s_autoscaling_job_count_strategy_default_with_node_max_sessions
88-
- k8s-version: 'v1.33.6'
88+
- k8s-version: 'v1.34.11'
8989
cluster: 'minikube'
90-
helm-version: 'v3.19.2'
90+
helm-version: 'v3.20.2'
9191
docker-version: '29.1.1'
9292
python-version: '3.12'
9393
os: ubuntu-22.04
9494
test-strategy: test_k8s_autoscaling_job_count_strategy_default
95-
- k8s-version: 'v1.30.14'
95+
- k8s-version: 'v1.35.8'
9696
cluster: 'minikube'
97-
helm-version: 'v3.15.4'
98-
docker-version: '27.5.1'
97+
helm-version: 'v4.1.4'
98+
docker-version: '29.1.1'
99+
python-version: '3.13'
100+
os: ubuntu-22.04
101+
test-strategy: test_k8s_autoscaling_job_count_strategy_accurate_in_chaos
102+
- k8s-version: 'v1.35.8'
103+
cluster: 'minikube'
104+
helm-version: 'v3.20.2'
105+
docker-version: '29.1.1'
106+
python-version: '3.13'
107+
os: ubuntu-22.04
108+
test-strategy: test_k8s_autoscaling_job_count_strategy_accurate_with_node_max_sessions
109+
- k8s-version: 'v1.34.11'
110+
cluster: 'minikube'
111+
helm-version: 'v3.20.2'
112+
docker-version: '29.1.1'
99113
python-version: '3.12'
100114
os: ubuntu-22.04
101-
test-strategy: test_k8s_autoscaling_deployment_count_in_chaos
115+
test-strategy: test_k8s_autoscaling_job_count_strategy_accurate
102116
- k8s-version: 'v1.31.14'
103117
cluster: 'minikube'
104118
helm-version: 'v3.16.4'
119+
docker-version: '27.5.1'
120+
python-version: '3.12'
121+
os: ubuntu-22.04
122+
test-strategy: test_k8s_autoscaling_deployment_count_in_chaos
123+
- k8s-version: 'v1.32.13'
124+
cluster: 'minikube'
125+
helm-version: 'v3.17.4'
105126
docker-version: '28.5.2'
106127
python-version: '3.13'
107128
os: ubuntu-22.04
108129
test-strategy: test_k8s_autoscaling_deployment_count_with_node_max_sessions
109-
- k8s-version: 'v1.32.10'
130+
- k8s-version: 'v1.33.13'
110131
cluster: 'minikube'
111-
helm-version: 'v3.17.4'
132+
helm-version: 'v3.18.6'
112133
docker-version: '28.5.2'
113134
python-version: '3.11'
114135
os: ubuntu-22.04

‎.keda-external-scaler/PLAN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Everything downstream of T6 is sequential.
7171
- **Gate 1 (after T3):** `go test ./internal/gridscaler` green with unmodified
7272
upstream expectations → algorithm parity proven.
7373
- **Gate 2 (after T6):** in-process gRPC + fake Grid fixture test green,
74-
including all four `jobScalingStrategy` conventions and activation threshold →
74+
including both `includeOngoingSessions` conventions and activation threshold →
7575
wire-level parity proven.
7676
- **Gate 3 (after T8):** `make image` builds linux/amd64+arm64; container starts
7777
and serves health check.

‎.keda-external-scaler/README.md‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a functional extraction of KEDA's built-in `selenium-grid` scaler
88
(`kedacore/keda/pkg/scalers/selenium_grid_scaler.go`), so that Selenium's
99
autoscaling logic can be released on the docker-selenium cadence instead of
1010
KEDA's. The scaling algorithm — capability matching (mirroring Grid's
11-
`DefaultSlotMatcher`), slot reservation, and the per-`jobScalingStrategy` count
11+
`DefaultSlotMatcher`), slot reservation, and the `includeOngoingSessions` count
1212
conventions — is ported verbatim and covered by KEDA's own upstream test table.
1313

1414
## How it differs from the built-in scaler
@@ -43,14 +43,38 @@ the scaler):
4343
| `enableManagedDownloads` | `true` | |
4444
| `activationThreshold` | `0` | scale-from-zero threshold |
4545
| `unsafeSsl` | `false` | skip Grid TLS verification |
46-
| `jobScalingStrategy` | `default` | `default`\|`custom`\|`accurate`\|`eager`; must match the ScaledJob's `scalingStrategy.strategy` |
46+
| `includeOngoingSessions` | `true` | count on-going sessions toward the metric; must be `false` for ScaledJob `scalingStrategy.strategy` `accurate` or `eager` (see [On-going sessions](#on-going-sessions)) |
4747
| `authType` | `""` | `Basic` (default) or a bearer scheme like `OAuth2`/`Bearer` |
4848
| `username` / `password` | — | Grid basic auth |
4949
| `accessToken` | — | Grid bearer token (with non-Basic `authType`) |
5050

5151
Any key may also be supplied as `<key>FromEnv` (KEDA resolves it from the scale
5252
target's container env before sending).
5353

54+
### On-going sessions
55+
56+
The metric this scaler returns is the number of Nodes the Grid needs. On-going
57+
sessions are work the Grid is already serving, so whether they belong in that
58+
number depends on which Job count KEDA's executor deducts for you
59+
(`pkg/scaling/executor/scale_jobs.go`):
60+
61+
| ScaledJob strategy | KEDA deducts | `includeOngoingSessions` | Metric emitted |
62+
|---|---|---|---|
63+
| `default` | running Job count | `true` (default) | queued requests + on-going sessions |
64+
| `custom` | `customScalingRunningJobPercentage` of running Job count | `true` (default) | queued requests + on-going sessions |
65+
| `accurate` | pending Job count | **`false`** | queued requests only |
66+
| `eager` | running + pending Job count (bounded by `maxScale`) | **`false`** | queued requests only |
67+
| _ScaledObject (HPA)_ | running replicas via HPA | `true` (default) | queued requests + on-going sessions |
68+
69+
`accurate` and `eager` never re-add running work, so counting on-going sessions
70+
there double-counts sessions already in progress and produces runaway Node
71+
creation that never scales back down
72+
([#3167](https://github.com/SeleniumHQ/docker-selenium/issues/3167)).
73+
74+
The Selenium Grid Helm chart derives this for you from
75+
`autoscaling.scaledJobOptions.scalingStrategy.strategy`; set
76+
`<node>.hpa.includeOngoingSessions` to override.
77+
5478
## Authentication
5579

5680
Because authParams are not forwarded, resolve Grid URL and credentials by one of

‎.keda-external-scaler/SPEC.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ response — already mirrored at `.keda/scalers/selenium_grid_scaler.go`):
7777
requests, reserve free matching slots on existing UP nodes, then pack remaining
7878
requests onto hypothetical new nodes of capacity `nodeMaxSessions`; also count
7979
matching ongoing sessions
80-
- The metric convention per `jobScalingStrategy`:
81-
- `default`/`custom` (and all ScaledObjects): `count = newRequestNodes + onGoingSessions`
82-
- `accurate`/`eager`: `count = newRequestNodes`
80+
- The metric convention per `includeOngoingSessions`:
81+
- `true` (default; correct for ScaledJob `default`/`custom` and all
82+
ScaledObjects): `count = newRequestNodes + onGoingSessions`
83+
- `false` (required for ScaledJob `accurate`/`eager`): `count = newRequestNodes`
8384
- Activation: `count > activationThreshold`
8485

8586
## Tech Stack
@@ -151,7 +152,7 @@ triggers:
151152
enableManagedDownloads: "true"
152153
activationThreshold: "0"
153154
unsafeSsl: "false" # Grid TLS verification
154-
jobScalingStrategy: default # default|custom|accurate|eager
155+
includeOngoingSessions: "true" # set "false" for accurate|eager ScaledJobs
155156
authType: Basic # optional
156157
usernameFromEnv: SE_USERNAME # resolved by KEDA from scale-target env
157158
passwordFromEnv: SE_PASSWORD
@@ -166,7 +167,7 @@ entirely by mounting them into the scaler Deployment.
166167

167168
All values arrive as strings in the map; the server performs the same
168169
defaulting/validation the `keda:` struct tags did (`nodeMaxSessions=1`,
169-
`enableManagedDownloads=true`, `jobScalingStrategy∈{default,custom,accurate,eager}`,
170+
`enableManagedDownloads=true`, `includeOngoingSessions=true`,
170171
`sessionBrowserName←browserName`).
171172

172173
## Code Style
@@ -236,7 +237,7 @@ logging; no global mutable state except an HTTP client cache keyed by
236237
the same GraphQL fixture (verified by the shared test table).
237238
3. `GetMetricSpec` returns `selenium-grid[-browser][-version][-platform]` with
238239
`targetSize: 1`, matching the built-in naming after KEDA strips the index prefix.
239-
4. All four `jobScalingStrategy` values produce the two documented count
240+
4. Both `includeOngoingSessions` values produce the two documented count
240241
conventions (`+onGoingSessions` vs queue-only).
241242
5. Missing/invalid metadata yields `InvalidArgument`; Grid unreachable yields a
242243
non-OK status and KEDA logs it without crashing the server.

‎.keda-external-scaler/TASKS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ parallel after T1. See [PLAN.md](PLAN.md) for rationale.
2929
- [ ] **T4: Metadata parsing with env fallback**
3030
- Acceptance: `parseMetadata(map[string]string, envDefaults)` reproduces the
3131
`keda:` tag behavior (defaults `nodeMaxSessions=1`,
32-
`enableManagedDownloads=true`, `jobScalingStrategy` enum validation,
32+
`enableManagedDownloads=true`, `includeOngoingSessions=true`,
3333
`sessionBrowserName←browserName`, required `url`); strips `FromEnv` key
3434
suffixes; precedence `<name>` > `<name>FromEnv` > `SE_*` server env.
3535
- Verify: `go test ./internal/gridscaler -run TestParseMetadata`
@@ -47,11 +47,11 @@ parallel after T1. See [PLAN.md](PLAN.md) for rationale.
4747
- [ ] **T6: gRPC server implementation (parity gate 2)**
4848
- Acceptance: `GetMetricSpec` returns normalized
4949
`selenium-grid[-browser][-version][-platform]` with `targetSize=1`;
50-
`GetMetrics` returns count per `jobScalingStrategy` convention; `IsActive`
50+
`GetMetrics` returns count per `includeOngoingSessions` convention; `IsActive`
5151
returns `count > activationThreshold`; `StreamIsActive` returns
5252
`Unimplemented`; bad metadata → `InvalidArgument`, Grid failure → `Internal`.
5353
- Verify: `go test ./internal/gridscaler -run TestServer -race` (in-process
54-
grpc server + fake Grid fixtures covering all four strategies)
54+
grpc server + fake Grid fixtures covering both count conventions)
5555
- Files: `internal/gridscaler/server.go`, `internal/gridscaler/server_test.go`
5656

5757
- [ ] **T7: Binary entrypoint**

‎.keda-external-scaler/cmd/scaler/main_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ func TestParseFlagsDefaults(t *testing.T) {
7979
}
8080

8181
func TestParseFlagsOverridesAndEnv(t *testing.T) {
82-
t.Setenv("LISTEN_ADDRESS", ":9999") // overridden by flag below
83-
t.Setenv("SE_GRID_HTTP_TIMEOUT", "500") // bare int → ms (env default)
82+
t.Setenv("LISTEN_ADDRESS", ":9999") // overridden by flag below
83+
t.Setenv("SE_GRID_HTTP_TIMEOUT", "500") // bare int → ms (env default)
8484
t.Setenv("TLS_CERT_FILE", "/etc/cert.pem")
8585
t.Setenv("TLS_KEY_FILE", "/etc/key.pem")
8686

‎.keda-external-scaler/deploy/scaledjob-example.yaml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# `selenium-grid` scaler, so migrating from it is a mechanical change of `type`
66
# plus adding `scalerAddress`.
77
#
8-
# jobScalingStrategy MUST match spec.scalingStrategy.strategy below so the
9-
# emitted metric matches how KEDA computes effective max scale for Jobs.
8+
# includeOngoingSessions MUST agree with spec.scalingStrategy.strategy below so
9+
# the emitted metric matches how KEDA computes effective max scale for Jobs:
10+
# leave it "true" for `default`/`custom`, set it "false" for `accurate`/`eager`.
1011
apiVersion: keda.sh/v1alpha1
1112
kind: ScaledJob
1213
metadata:
@@ -42,7 +43,9 @@ spec:
4243
url: http://selenium-hub.selenium.svc:4444/graphql
4344
browserName: chrome
4445
nodeMaxSessions: "1"
45-
jobScalingStrategy: default
46+
# strategy below is `default`, which deducts running Jobs, so on-going
47+
# sessions must stay in the metric. Set "false" for accurate/eager.
48+
includeOngoingSessions: "true"
4649
activationThreshold: "0"
4750
# For basic-auth Grids, resolve credentials from the Job's own env:
4851
# usernameFromEnv: SE_ROUTER_USERNAME

‎.keda-external-scaler/deploy/scaledobject-example.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Example ScaledObject (Deployment-based scaling) using the external scaler.
22
#
3-
# ScaledObjects always use the "total desired" convention, so jobScalingStrategy
4-
# is left at its default. The scaler reports queued requests plus on-going
5-
# sessions, which the HPA divides by the target value (1) to get replicas.
3+
# ScaledObjects always use the "total desired" convention, so
4+
# includeOngoingSessions is left at its default of true. The scaler reports
5+
# queued requests plus on-going sessions, which the HPA divides by the target
6+
# value (1) to get replicas.
67
apiVersion: keda.sh/v1alpha1
78
kind: ScaledObject
89
metadata:

0 commit comments

Comments
 (0)