Skip to content

Commit d76dc4c

Browse files
committed
feat(chart): Log Node preStop exec to console
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent 01fc206 commit d76dc4c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.github/workflows/helm-chart-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint and Test Helm Charts
1+
name: Test Helm Charts
22

33
on:
44
push:
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
build-and-test:
17-
name: Test Helm charts
17+
name: Build & test
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: false

charts/selenium-grid/configs/node/nodePreStop.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ fi
88

99
if curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status; then
1010
curl -k -X POST ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/se/grid/node/drain --header "${HEADERS}"
11-
while curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status; do sleep 1; done
11+
while curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o /tmp/preStopOutput;
12+
do
13+
echo "Node preStop is waiting for current session to be finished if any.\nNode details: \
14+
.value.message: $(jq -r '.value.message' /tmp/preStopOutput || "unknown"), \
15+
.value.node.availability: $(jq -r '.value.node.availability' /tmp/preStopOutput || "unknown")"
16+
sleep 1;
17+
done
1218
else
1319
echo "Node is already drained. Shutting down gracefully!"
1420
fi

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ Define preStop hook for the node pod. Node preStop script is stored in a ConfigM
668668
{{- define "seleniumGrid.node.deregisterLifecycle" -}}
669669
preStop:
670670
exec:
671-
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh"]
671+
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh >> /proc/1/fd/1"]
672672
{{- end -}}
673673

674674
{{/*

0 commit comments

Comments
 (0)