K8s: Implement KEDA external scaler and use it as default#3169
Conversation
be58cc2 to
be29ccf
Compare
PR Summary by QodoK8s: Add standalone KEDA external scaler for Selenium Grid autoscaling
AI Description
Diagram
High-Level Assessment
Files changed (37)
|
Code Review by Qodo
1. Panic on bad capabilities
|
be29ccf to
de82b58
Compare
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
de82b58 to
92d7cbf
Compare
…unAsNonRoot The scaler pod failed to start with CreateContainerConfigError because the distroless image ran as the non-numeric user "nonroot" while the pod set securityContext.runAsNonRoot: true without a numeric runAsUser. Kubernetes cannot verify a name-based user is non-root and rejects the container. Use the numeric distroless uid/gid (65532) in the Dockerfile USER, and set runAsUser/runAsGroup: 65532 explicitly in the chart template and the reference Deployment so the runAsNonRoot check passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cc3a9ea to
3af6405
Compare
…ons strategy For scalingType=job, set the trigger metadata jobScalingStrategy to the effective ScaledJob scalingStrategy.strategy (autoscaling.scaledJobOptions, including per-node overrides). This keeps the scaler's count convention in lockstep with the ScaledJob strategy KEDA applies, avoiding the accurate/eager double-counting (#3167). Applies to both the external and built-in selenium-grid scalers; omitted for deployment scaling. A value set explicitly in node.hpa still takes precedence. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
3af6405 to
8dc5031
Compare
…tegy Make the external scaler the chart default (autoscaling.externalScaler.enabled: true) and default the ScaledJob scalingStrategy.strategy to "accurate" (the value the scaler needs to avoid accurate/eager double-counting, #3167). Test script: - default SCALING_STRATEGY to accurate to match the chart. - pin autoscaling.externalScaler.enabled=${TEST_EXTERNAL_SCALER} deterministically so built-in strategies still exercise selenium-grid despite the new default, while job_externalScaler exercises the external path. - chart_test_autoscaling_job_externalScaler sets TEST_EXTERNAL_SCALER=true so it works for local runs too, and is added to the render-template list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
f0b9bb0 to
dfca4d7
Compare
With the external scaler now the chart default, ScaledObject/ScaledJob triggers use type: external with a scalerAddress and no authenticationRef, which broke test_scaler_triggers_authenticationRef_name_is_added (KeyError: authenticationRef). Rewrite it as test_scaler_triggers_auth_wiring: assert scalerAddress and absence of authenticationRef for external triggers, and authenticationRef.name for the built-in selenium-grid triggers. This passes for either default. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
dfca4d7 to
d0ed386
Compare
Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Instead of relying on the built-in Selenium Grid scaler in the KEDA core package.
Use the concept of External Scaler (https://keda.sh/docs/latest/concepts/external-scalers/), where implementing the logic on top of KEDA, any logic change can be patched independently in the external scaler managed
Motivation and Context
Types of changes
Checklist