Skip to content

Commit

Permalink
feat(chart): Log Node preStop exec to console
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Jan 29, 2024
1 parent 01fc206 commit d76dc4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/helm-chart-test.yml
@@ -1,4 +1,4 @@
name: Lint and Test Helm Charts
name: Test Helm Charts

on:
push:
Expand All @@ -14,7 +14,7 @@ permissions:

jobs:
build-and-test:
name: Test Helm charts
name: Build & test
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
8 changes: 7 additions & 1 deletion charts/selenium-grid/configs/node/nodePreStop.sh
Expand Up @@ -8,7 +8,13 @@ fi

if curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status; then
curl -k -X POST ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/se/grid/node/drain --header "${HEADERS}"
while curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status; do sleep 1; done
while curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o /tmp/preStopOutput;
do
echo "Node preStop is waiting for current session to be finished if any.\nNode details: \
.value.message: $(jq -r '.value.message' /tmp/preStopOutput || "unknown"), \
.value.node.availability: $(jq -r '.value.node.availability' /tmp/preStopOutput || "unknown")"
sleep 1;
done
else
echo "Node is already drained. Shutting down gracefully!"
fi
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/_helpers.tpl
Expand Up @@ -668,7 +668,7 @@ Define preStop hook for the node pod. Node preStop script is stored in a ConfigM
{{- define "seleniumGrid.node.deregisterLifecycle" -}}
preStop:
exec:
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh"]
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh >> /proc/1/fd/1"]
{{- end -}}

{{/*
Expand Down

0 comments on commit d76dc4c

Please sign in to comment.