Skip to content

Commit 9f90be0

Browse files
authored
Update pod termination process for Selenium Grid
apply fix for all axamples
1 parent c294814 commit 9f90be0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

website_and_docs/content/blog/2022/scaling-grid-with-keda.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ grace period for your cluster nodes as well.
132132
- We curl the `localhost` of our pod to tell it to drain. The pod will no
133133
longer accept new session requests and will finish its current test. More
134134
information on this [can be found in the Selenium Grid documentation](https://www.selenium.dev/documentation/grid/advanced_features/endpoints/#drain).
135-
- We then tail the internal node process that will continue to run until the node has been drained.
136-
- After this we give the pod 30 seconds to finish anything else before giving the full termination command.
135+
- Poll the Selenium node /status endpoint and wait until it becomes unavailable, indicating that the node has been fully drained and terminated.
136+
- After this we give the pod 10 seconds to finish anything else before giving the full termination command.
137137

138138
And with that our application can now safely scale down our selenium browser deployments!
139139

@@ -216,7 +216,7 @@ spec:
216216
lifecycle:
217217
preStop:
218218
exec:
219-
command: ["/bin/sh", "-c", "curl --request POST 'localhost:5555/se/grid/node/drain' --header 'X-REGISTRATION-SECRET;'; tail --pid=$(pgrep -f '[n]ode --bind-host false --config /opt/selenium/config.toml') -f /dev/null; sleep 30s"]
219+
command: ["/bin/sh", "-c", "curl --request POST 'localhost:5555/se/grid/node/drain' --header 'X-REGISTRATION-SECRET;'; while curl -fs localhost:5555/status >/dev/null; do sleep 1; done; sleep 10"]
220220
```
221221

222222
That is it, your Selenium Grid pods should now scale up and down properly without any lost sessions!

0 commit comments

Comments
 (0)