You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Motivation and Context
Before, autoscaling recommends each Node should have 1 session. However, due to user demand, and Node also can configure a different number of max sessions per node via SE_NODE_MAX_SESSIONS
Once Node is set the max sessions greater than 1, the scaler trigger parameter nodeMaxSessions need to be set for calculation can be aware Node capacity will be scaled up. Refer to https://github.com/SeleniumHQ/docker-selenium/blob/trunk/.keda/scalers/selenium-grid-scaler.md
Potential Bug The SE_DRAIN_AFTER_SESSION_COUNT environment variable is set based on the nodeMaxSessions value, but it's not clear if this is the intended behavior for all scaling types.
Configuration Change The SE_DRAIN_AFTER_SESSION_COUNT environment variable has been removed from the node configmap. This might affect the behavior of node draining.
Add a comment to explain the purpose of an environment variable
Consider adding a comment explaining the purpose of the SE_DRAIN_AFTER_SESSION_COUNT environment variable and its relationship with KEDA and autoscaling.
+# Set SE_DRAIN_AFTER_SESSION_COUNT to nodeMaxSessions if KEDA is used and scaling type is job, otherwise set to 0
- name: SE_DRAIN_AFTER_SESSION_COUNT
value: {{ and (eq (include "seleniumGrid.useKEDA" $) "true") (eq .Values.autoscaling.scalingType "job") | ternary $nodeMaxSessions 0 | quote }}
Apply this suggestion
Suggestion importance[1-10]: 8
Why: Adding a comment to explain the purpose of the environment variable significantly aids in understanding the code, especially for new developers or maintainers.
8
Enhancement
Improve variable naming for better code readability and maintainability
Use a more descriptive variable name instead of 'count' to improve code readability and maintainability.
-count = 0+matched_resources_count = 0
for resource_name in resources_name.keys():
for doc in LIST_OF_DOCUMENTS:
if doc['metadata']['name'] == resource_name and doc['kind'] == 'ScaledObject':
logger.info(f"Assert nodeMaxSessions parameter is set in scaler triggers")
self.assertTrue(doc['spec']['triggers'][0]['metadata']['nodeMaxSessions'] == str(resources_name[doc['metadata']['name']]))
if doc['metadata']['name'] == resource_name and doc['kind'] == 'Deployment':
for env in doc['spec']['template']['spec']['containers'][0]['env']:
if env['name'] == 'SE_NODE_MAX_SESSIONS':
self.assertTrue(env['value'] == str(resources_name[doc['metadata']['name']]), "Value is not matched")
- count += 1-self.assertEqual(count, len(resources_name.keys()), "Expected {0} resources but found {1}".format(len(resources_name.keys()), count))+ matched_resources_count += 1+self.assertEqual(matched_resources_count, len(resources_name.keys()), "Expected {0} resources but found {1}".format(len(resources_name.keys()), matched_resources_count))
Apply this suggestion
Suggestion importance[1-10]: 7
Why: The suggestion to use a more descriptive variable name enhances code readability and maintainability, which is beneficial for understanding and future modifications.
7
Improve variable naming for better code readability
Consider using a more descriptive variable name for clarity, such as nodeMaxSessionsValue instead of $nodeMaxSessions.
Why: While using explicit boolean comparison can improve clarity, the current implicit conversion is already clear in context, making this suggestion a minor improvement.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
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
Motivation and Context
Before, autoscaling recommends each Node should have 1 session. However, due to user demand, and Node also can configure a different number of max sessions per node via
SE_NODE_MAX_SESSIONS
Once Node is set the max sessions greater than 1, the scaler trigger parameter
nodeMaxSessions
need to be set for calculation can be aware Node capacity will be scaled up. Refer to https://github.com/SeleniumHQ/docker-selenium/blob/trunk/.keda/scalers/selenium-grid-scaler.mdThis is still an experimental feature, so it requires KEDA core components image tag with the patch scaler implementation - see https://github.com/SeleniumHQ/docker-selenium/blob/trunk/.keda/README.md
Types of changes
Checklist
PR Type
Enhancement, Tests, Documentation
Description
nodeMaxSessions
for each browser node (Chrome, Firefox, Edge) in Selenium Grid.nodeMaxSessions
and authentication references in scaler triggers.Changes walkthrough 📝
1 files
video.sh
Fix spacing in GraphQL endpoint error message
Video/video.sh
6 files
chart_test.sh
Add max session configuration for browser nodes
tests/charts/make/chart_test.sh
Makefile
Configure max sessions for autoscaling tests
Makefile
tests.
node-configmap.yaml
Remove SE_DRAIN_AFTER_SESSION_COUNT configuration
charts/selenium-grid/templates/node-configmap.yaml
values.yaml
Add nodeMaxSessions configuration and update kubectl image
charts/selenium-grid/values.yaml
dummy.yaml
Configure nodeMaxSessions in dummy render template
tests/charts/templates/render/dummy.yaml
dummy_solution.yaml
Configure nodeMaxSessions in dummy solution template
tests/charts/templates/render/dummy_solution.yaml
1 files
test.py
Add tests for scaler triggers and nodeMaxSessions
tests/charts/templates/test.py
1 files
_helpers.tpl
Add nodeMaxSessions to autoscaling and pod templates
charts/selenium-grid/templates/_helpers.tpl
2 files
README.md
Update KEDA core Helm chart link
.keda/README.md
CONFIGURATION.md
Document nodeMaxSessions and update kubectl image
charts/selenium-grid/CONFIGURATION.md