-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Selenium Grid in case multiple scaler triggers are activate #6437
Conversation
0153063
to
8615239
Compare
…sion triggers are active Signed-off-by: Viet Nguyen Duc <[email protected]>
Signed-off-by: Viet Nguyen Duc <[email protected]>
Signed-off-by: Viet Nguyen Duc <[email protected]>
/run-e2e selenium |
/run-e2e selenium |
Can you try e2e run one more time, I guess pull image could take time or reach pull limit rate...Here is result in my local EXECUTION SUMMARY
##############################################
##############################################
Passed tests:
Execution of tests/scalers/selenium/selenium_test.go, has passed after "one" attempts |
It looks like issue reaching the hub ->
I'm checking another issue in my local, once I finish I'll try to check this too |
@JorTurFer, I also done other tests in downstream repos. Let's rerun the e2e job here to see any luck :) |
/run-e2e selenium |
Thanks for your info, I am checking it in local again now |
The cluster can be accessed, right? how about when |
let me check |
I've added a print, and this is the content of the Hub response's body (the missing 2 are most probably because when I started the pod manually, they were processed) {
"data": {
"grid": {
"sessionCount": 0,
"maxSession": 0,
"totalSlots": 0
},
"nodesInfo": {
"nodes": [
]
},
"sessionsInfo": {
"sessionQueueRequests": [
"{\n \"acceptInsecureCerts\": true,\n \"browserName\": \"firefox\",\n \"moz:firefoxOptions\": {\n \"args\": [\n \"-remote-debugging-port\",\n \"40627\"\n ]\n }\n}",
"{\n \"acceptInsecureCerts\": true,\n \"browserName\": \"chrome\"\n}",
"{\n \"acceptInsecureCerts\": true,\n \"browserName\": \"firefox\",\n \"moz:firefoxOptions\": {\n \"args\": [\n \"-remote-debugging-port\",\n \"40947\"\n ]\n }\n}",
"{\n \"acceptInsecureCerts\": true,\n \"browserName\": \"chrome\"\n}"
]
}
}
} |
Now I'm debugging this function: // This function checks if the request capabilities match the scaler metadata
func checkRequestCapabilitiesMatch(request Capability, browserName string, browserVersion string, _ string, platformName string) bool {
// Check if browserName matches
browserNameMatch := request.BrowserName == "" && browserName == "" ||
strings.EqualFold(browserName, request.BrowserName)
// Check if browserVersion matches
browserVersionMatch := (request.BrowserVersion == "" && browserVersion == "") ||
(request.BrowserVersion == "stable" && browserVersion == "") ||
(strings.HasPrefix(browserVersion, request.BrowserVersion) && request.BrowserVersion != "" && browserVersion != "")
// Check if platformName matches
platformNameMatch := request.PlatformName == "" && platformName == "" ||
strings.EqualFold(platformName, request.PlatformName)
return browserNameMatch && browserVersionMatch && platformNameMatch
} And the platformName doesn't match // Check if platformName matches
platformNameMatch := request.PlatformName == "" && platformName == "" ||
strings.EqualFold(platformName, request.PlatformName) So the result of the function is // Check if platformName matches
platformNameMatch := request.PlatformName == "" ||
strings.EqualFold(platformName, request.PlatformName) WDYT? I've tested that change locally and it works |
Yes, that is reason I also updated in deployment container env
To override the Node stereotypes be aligned with scaler metadata |
Signed-off-by: Viet Nguyen Duc <[email protected]>
Does it make sense to update the logic to not check the platform/browser/version if the request doesn't specify it? I mean, from my naive pov, if the request doesn't define those values it's because any node can handle that request. |
I changed |
/run-e2e selenium |
I'm checking it locally right now |
The problem that I see is that the nodes aren't starting, so any change applied in nodes isn't taken into account, at least until the node starts. As all the nodes are deployed scaled to 0, any configuration in the node won't be reflected in the hub |
Without set platfromName as EMPTY in Node config, it looks like it assumes as Windows by default in Grid...then the scaler scale it down to 0, due to mismatch with metadata |
Give me some time, I will fix the test need to enforce |
I've written you by Slack, maybe it'll be faster :) |
Signed-off-by: Viet Nguyen Duc <[email protected]>
/run-e2e selenium |
…acore#6437) * fix: Selenium Grid scaler avoids overlapping when multiple browserVersion triggers are active Signed-off-by: Viet Nguyen Duc <[email protected]> * Update CHANGELOG Signed-off-by: Viet Nguyen Duc <[email protected]> * Fix e2e template test Signed-off-by: Viet Nguyen Duc <[email protected]> * Change imagePullPolicy to Always to take latest change Signed-off-by: Viet Nguyen Duc <[email protected]> * Update platformName default value as empty Signed-off-by: Viet Nguyen Duc <[email protected]> --------- Signed-off-by: Viet Nguyen Duc <[email protected]> Signed-off-by: Jorge Turrado <[email protected]>
* fix: CVE-2024-45337 (#6422) Signed-off-by: Jorge Turrado <[email protected]> * :fix: ensure consistent JSON log format for automaxprocs (#6335) * fix: ensure consistent JSON log format for automaxprocs Signed-off-by: Omer Aplatony <[email protected]> * moved to Unreleased Signed-off-by: Omer Aplatony <[email protected]> --------- Signed-off-by: Omer Aplatony <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> * Upgrade to the latest new-relic-go v2 client (#6325) Signed-off-by: Jorge Turrado <[email protected]> * refactor: replace experimental `maps` and `slices` with stdlib (#6372) Signed-off-by: Eng Zer Jun <[email protected]> Signed-off-by: Jan Wozniak <[email protected]> Co-authored-by: Jan Wozniak <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> * fix: Selenium Grid scaler exposes sum of pending and ongoing sessions to KDEA (#6368) Signed-off-by: Jorge Turrado <[email protected]> * fix: scaledjobs stuck as not ready (#6329) since code was missing for setting a scaledjob as ready it was stuck as unready if there ever was a problem This is a fix for a regression in #5916 Signed-off-by: Mårten Svantesson <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> * fix: Paused ScaledObject count is reported correctly after operator restart (#6322) Signed-off-by: Jorge Turrado <[email protected]> * update changelog Signed-off-by: Jorge Turrado <[email protected]> * Bump go and deps (#6434) * Bump go and deps Signed-off-by: Jorge Turrado <[email protected]> * bump golang.org/x/net Signed-off-by: Jorge Turrado <[email protected]> * Add missing permissions to code-scaners Signed-off-by: Jorge Turrado <[email protected]> * update release tracker Signed-off-by: Jorge Turrado <[email protected]> * fix aws scaler Signed-off-by: Jorge Turrado <[email protected]> * Pass theregion Signed-off-by: Jorge Turrado <[email protected]> * Pass theregion Signed-off-by: Jorge Turrado <[email protected]> * fix aws tests Signed-off-by: Jorge Turrado <[email protected]> * fix aws tests Signed-off-by: Jorge Turrado <[email protected]> * Update AWS admission probes Signed-off-by: Jorge Turrado <[email protected]> --------- Signed-off-by: Jorge Turrado <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> * commit last vendored deps Signed-off-by: Jorge Turrado <[email protected]> * fix: Selenium Grid in case multiple scaler triggers are activate (#6437) * fix: Selenium Grid scaler avoids overlapping when multiple browserVersion triggers are active Signed-off-by: Viet Nguyen Duc <[email protected]> * Update CHANGELOG Signed-off-by: Viet Nguyen Duc <[email protected]> * Fix e2e template test Signed-off-by: Viet Nguyen Duc <[email protected]> * Change imagePullPolicy to Always to take latest change Signed-off-by: Viet Nguyen Duc <[email protected]> * Update platformName default value as empty Signed-off-by: Viet Nguyen Duc <[email protected]> --------- Signed-off-by: Viet Nguyen Duc <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> * add missing change Signed-off-by: Jorge Turrado <[email protected]> --------- Signed-off-by: Jorge Turrado <[email protected]> Signed-off-by: Omer Aplatony <[email protected]> Signed-off-by: Eng Zer Jun <[email protected]> Signed-off-by: Jan Wozniak <[email protected]> Signed-off-by: Mårten Svantesson <[email protected]> Signed-off-by: Jorge Turrado <[email protected]> Signed-off-by: Viet Nguyen Duc <[email protected]> Co-authored-by: Omer Aplatony <[email protected]> Co-authored-by: smcavallo <[email protected]> Co-authored-by: Eng Zer Jun <[email protected]> Co-authored-by: Jan Wozniak <[email protected]> Co-authored-by: Viet Nguyen Duc <[email protected]> Co-authored-by: Mårten Svantesson <[email protected]>
Implement strictly the condition to trigger the scaler in complex cases that Selenium Grid includes autoscaling Nodes (with multiple scaledObject with different triggers metadata), non-autoscaling Nodes, relay Nodes, and so on.
In general, update the scaler logic should be aligned with Selenium Grid core in
DefaultSlotMatcher
- which can be inspected https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/grid/data/DefaultSlotMatcher.javaIt is also recommended to set the
browserName
,browserVersion
, andplatformName
to align across request capabilities, Node stereotype and scaler trigger params to have correct scaling behavior.In terms of
SlotMatcher
in Grid, there is no valuelatest
for the capabilitybrowserVersion
. So, remove that valuelatest
and keep the default value EMPTY.The default value of
platformName
is also updated to EMPTY. Let the user set the value that matches withplatformName
in Node stereotype and request capability that they want to scale by this ScaledObject/ScaledJob.So, with the default scaler metadata (only
browserName
is mandatory to set)It will scale up Node for the request (in Python binding example)
For example, the client sends the request with
platfromName
capability setIt is equivalent to scaler trigger params settings.
For example, the client sends the request.
The scaler trigger param should be aligned as
Most people are using the popular browser node image from the project docker-selenium. In default Node stereotype, the short browser version is set for
browserVersion
, it might cause breaking backward compatiblity, or request withoutbrowserVersion
could not trigger scaler anymore. Via SeleniumHQ/docker-selenium#2520, you can setSE_NODE_BROWSER_VERSION
as empty to unset the default version (take newer docker image tag from that project, which contains the change onwards).This also avoids multiple scalers, for example same
browserName
combines multiplebrowserVersion
could have issue with overlapping in counting number of ongoing and pending sessions belonging to each scaler trigger.In terms of Selenium Grid v4, it has a kind of Relay Node, which has capabilities to forward commands to the Appium instance. With this Node type, the
browserName
is optional. So, updating the trigger parambrowserName
to optional.Checklist
Fixes #
Relates to #