Skip to content

Commit 48779a6

Browse files
committed
Update docs for Helm config nodeDrainAfterSessionCount
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent de79a39 commit 48779a6

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

charts/selenium-grid/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ This chart enables the creation of a Selenium Grid Server in Kubernetes.
2727
* [Configuration `global.K8S_PUBLIC_IP`](#configuration-globalk8s_public_ip)
2828
* [Configuration of Nodes](#configuration-of-nodes)
2929
* [Container ports and Service ports](#container-ports-and-service-ports)
30+
* [Settings Node drain after session count](#settings-node-drain-after-session-count)
3031
* [Configuration of shm size limit for browser nodes](#configuration-of-shm-size-limit-for-browser-nodes)
3132
* [Configuration of Probes](#configuration-of-probes)
3233
* [Node Probes](#node-probes)
@@ -563,6 +564,21 @@ edgeNode:
563564
protocol: TCP
564565
```
565566

567+
#### Settings Node drain after session count
568+
569+
In case of autoscaling enabled, with scaling type `job`, Node will be drained following `nodeMaxSessions` (default is 1). So, behavior here is Job will take one session and then Node will be drained after that (something like one-time node). If you want to change this behavior, you can adjust the value in `nodeDrainAfterSessionCount` greater than `nodeMaxSessions` to take effect.
570+
571+
In another hand, with scaling type `deployment`, Node only get drained when HPA choose pods to terminate (which aligns with `nodeDrainAfterSessionCount` is 0 by default). If you want to drain Node by your own logic, you can adjust the value in `nodeDrainAfterSessionCount` greater than 0 to take effect. The same logic applies in normal deployment as well (without autoscaling).
572+
573+
```yaml
574+
global:
575+
seleniumGrid:
576+
nodeDrainAfterSessionCount: 30 # Apply for all nodes
577+
578+
chromeNode:
579+
nodeDrainAfterSessionCount: 10 # Set another value for chrome node
580+
```
581+
566582
#### Configuration of shm size limit for browser nodes
567583
568584
By default, node browsers (Chrome/Chromium, Edge) leave the config key `dshmVolumeSizeLimit` as empty. It means the `/dev/shm` volume mount is disabled, and argument `--disable-dev-shm-usage` is passed to the browser via container environment variable (get motivation from [this post](https://www.ministryoftesting.com/articles/navigating-chromedriver-crashes-in-kubernetes-a-tale-of-test-automation-resilience)). You can set another valid value to enable it back. For example:

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ template:
572572
- name: SE_NODE_MAX_SESSIONS
573573
value: {{ $nodeMaxSessions | quote }}
574574
- name: SE_DRAIN_AFTER_SESSION_COUNT
575-
value: {{ and (eq (include "seleniumGrid.useKEDA" $) "true") (eq .Values.autoscaling.scalingType "job") | ternary $nodeMaxSessions 0 | quote }}
575+
value: {{ and (eq (include "seleniumGrid.useKEDA" $) "true") (eq .Values.autoscaling.scalingType "job") | ternary (max $nodeMaxSessions $nodeDrainAfterSessionCount) $nodeDrainAfterSessionCount | quote }}
576576
- name: SE_NODE_PORT
577577
value: {{ .node.port | quote }}
578578
- name: DISPLAY_CONTAINER_NAME

charts/selenium-grid/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ global:
5252
# Note: If not define labelSelector, it will be added automatically based on "app" label in each component
5353
# -- Specify number of max sessions per node. Can be overridden by individual component (this is also set to scaler trigger parameter `nodeMaxSessions` if `autoscaling` is enabled)
5454
nodeMaxSessions: 1
55-
# Noted:In case of autoscaling enabled, with scaling type `job`, Node will be drained following `nodeMaxSessions` by default
55+
# Noted: In case of autoscaling enabled, with scaling type `job`, Node will be drained following `nodeMaxSessions` by default
5656
# If changing `nodeDrainAfterSessionCount` > `nodeMaxSessions` it will take precedence over `nodeMaxSessions` in scaling type `job`
57+
# For other cases, `nodeDrainAfterSessionCount` > 0 always take effect.
5758
# -- Set number of sessions will be executed in a Node before detaching it from Hub and shutting it down
5859
nodeDrainAfterSessionCount: 0
5960
# -- This causes the Node to auto manage files downloaded for a given session on the Node (https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/#enable-downloads-in-the-grid)

tests/charts/templates/render/dummy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ global:
1818
topologyKey: kubernetes.io/hostname
1919
whenUnsatisfiable: DoNotSchedule
2020
nodeMaxSessions: 3
21+
nodeDrainAfterSessionCount: 30
2122
nodeEnableManagedDownloads: true
2223
nodeCustomCapabilities: "{'myApp:version':'beta','myApp:publish':'public'}"
2324

@@ -138,6 +139,7 @@ components:
138139

139140
chromeNode:
140141
nodeMaxSessions: 2
142+
nodeDrainAfterSessionCount: 10
141143
annotations:
142144
"restartOnUpdate": "true"
143145
terminationGracePeriodSeconds: 7200
@@ -146,6 +148,7 @@ chromeNode:
146148

147149
firefoxNode:
148150
nodeMaxSessions: 1
151+
nodeDrainAfterSessionCount: 20
149152
annotations:
150153
"restartOnUpdate": "true"
151154
terminationGracePeriodSeconds: 720

tests/charts/templates/render/dummy_solution.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ global:
1818
topologyKey: kubernetes.io/hostname
1919
whenUnsatisfiable: DoNotSchedule
2020
nodeMaxSessions: 3
21+
nodeDrainAfterSessionCount: 30
2122
nodeEnableManagedDownloads: true
2223
nodeCustomCapabilities: "{'myApp:version':'beta','myApp:publish':'public'}"
2324

@@ -130,13 +131,15 @@ selenium-grid:
130131

131132
chromeNode:
132133
nodeMaxSessions: 2
134+
nodeDrainAfterSessionCount: 10
133135
affinity: *affinity
134136
terminationGracePeriodSeconds: 7200
135137
service:
136138
enabled: true
137139

138140
firefoxNode:
139141
nodeMaxSessions: 1
142+
nodeDrainAfterSessionCount: 20
140143
affinity: *affinity
141144
terminationGracePeriodSeconds: 720
142145
service:

0 commit comments

Comments
 (0)