Skip to content

Commit ea2ebb0

Browse files
committed
fix(chart): connection in script of Node startup probe and preStop lifecycle
Fixed #2141 Fixed #2157 Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent d56f01c commit ea2ebb0

File tree

14 files changed

+253
-133
lines changed

14 files changed

+253
-133
lines changed

.github/workflows/nightly.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ jobs:
8181
- name: Update tag in docs and files
8282
run: ./update_tag_in_docs_and_files.sh ${LATEST_TAG} ${NEXT_TAG}
8383
- name: Setup environment to build chart
84-
run: make chart_setup_env
84+
uses: nick-invision/retry@master
85+
with:
86+
timeout_minutes: 10
87+
max_attempts: 3
88+
command: CLUSTER=${CLUSTER} HELM_VERSION=${HELM_VERSION} make chart_setup_env
8589
- name: Build and lint charts
8690
run: |
8791
make chart_build_nightly

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,16 +461,18 @@ chart_test_edge:
461461

462462
chart_test_autoscaling_deployment_https:
463463
CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_INGRESS_HOSTNAME=true CHART_ENABLE_BASIC_AUTH=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 \
464+
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 \
464465
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
465466
./tests/charts/make/chart_test.sh DeploymentAutoscaling
466467

467468
chart_test_autoscaling_deployment:
468-
CHART_ENABLE_TRACING=true SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_HOST=$$(hostname -i) \
469+
CHART_ENABLE_TRACING=true SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_HOST=$$(hostname -i) RELEASE_NAME=selenium \
470+
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 \
469471
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
470472
./tests/charts/make/chart_test.sh DeploymentAutoscaling
471473

472474
chart_test_autoscaling_job_https:
473-
SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_PROTOCOL=https CHART_ENABLE_BASIC_AUTH=true RELEASE_NAME=selenium SELENIUM_GRID_PORT=443 \
475+
SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_PROTOCOL=https CHART_ENABLE_BASIC_AUTH=true RELEASE_NAME=selenium SELENIUM_GRID_PORT=443 SUB_PATH=/ \
474476
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
475477
./tests/charts/make/chart_test.sh JobAutoscaling
476478

@@ -480,7 +482,7 @@ chart_test_autoscaling_job_hostname:
480482
./tests/charts/make/chart_test.sh JobAutoscaling
481483

482484
chart_test_autoscaling_job:
483-
CHART_ENABLE_TRACING=true CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_HOST=selenium-grid.local RELEASE_NAME=selenium \
485+
CHART_ENABLE_TRACING=true CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_HOST=selenium-grid.local RELEASE_NAME=selenium SUB_PATH=/ \
484486
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
485487
./tests/charts/make/chart_test.sh JobAutoscaling
486488

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
#!/bin/bash
22

3+
probe_name="lifecycle.${1:-"preStop"}"
4+
5+
max_time=3
6+
7+
ID=$(echo $RANDOM)
8+
tmp_node_file="/tmp/nodeProbe${ID}"
9+
310
function on_exit() {
4-
rm -rf /tmp/preStopOutput
11+
rm -rf ${tmp_node_file}
512
}
613
trap on_exit EXIT
714

15+
function init_file() {
16+
echo "{}" > ${tmp_node_file}
17+
}
18+
init_file
19+
820
# Set headers if Node Registration Secret is set
9-
if [ ! -z "${SE_REGISTRATION_SECRET}" ];
10-
then
21+
if [ ! -z "${SE_REGISTRATION_SECRET}" ]; then
1122
HEADERS="X-REGISTRATION-SECRET: ${SE_REGISTRATION_SECRET}"
1223
else
1324
HEADERS="X-REGISTRATION-SECRET;"
@@ -16,66 +27,81 @@ fi
1627
function is_full_distributed_mode() {
1728
if [ -n "${SE_DISTRIBUTOR_HOST}" ] && [ -n "${SE_DISTRIBUTOR_PORT}" ]; then
1829
DISTRIBUTED_MODE=true
19-
echo "Detected full distributed mode: ${DISTRIBUTED_MODE}. Since SE_DISTRIBUTOR_HOST and SE_DISTRIBUTOR_PORT are set in Node ConfigMap"
30+
echo "$(date +%FT%T%Z) [${probe_name}] - Detected full distributed mode: ${DISTRIBUTED_MODE}. Since SE_DISTRIBUTOR_HOST and SE_DISTRIBUTOR_PORT are set in Node ConfigMap"
2031
else
2132
DISTRIBUTED_MODE=false
22-
echo "Detected full distributed mode: ${DISTRIBUTED_MODE}"
33+
echo "$(date +%FT%T%Z) [${probe_name}] - Detected full distributed mode: ${DISTRIBUTED_MODE}"
2334
fi
2435
}
2536
is_full_distributed_mode
2637

38+
function get_grid_url() {
39+
if [ -z "${SE_HUB_HOST:-$SE_ROUTER_HOST}" ] || [ -z "${SE_HUB_PORT:-$SE_ROUTER_PORT}" ]; then
40+
echo "$(date +%FT%T%Z) [${probe_name}] - There is no configured HUB or ROUTER host. preStop ignores to send drain request to upstream."
41+
grid_url=""
42+
fi
43+
if [ -n "${SE_BASIC_AUTH}" ] && [ "${SE_BASIC_AUTH}" != "*@" ]; then
44+
SE_BASIC_AUTH="${SE_BASIC_AUTH}@"
45+
fi
46+
if [ "${SE_SUB_PATH}" = "/" ]; then
47+
SE_SUB_PATH=""
48+
fi
49+
grid_url=${SE_SERVER_PROTOCOL}://${SE_BASIC_AUTH}${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}${SE_SUB_PATH}
50+
grid_url_checks=$(curl -m ${max_time} -s -o /dev/null -w "%{http_code}" ${grid_url})
51+
if [ "${grid_url_checks}" = "401" ]; then
52+
echo "$(date +%FT%T%Z) [${probe_name}] - Host requires Basic Auth. Please add the credentials to the SE_BASIC_AUTH variable (e.g: user:password). preStop ignores to send drain request to upstream."
53+
grid_url=""
54+
fi
55+
if [ "${grid_url_checks}" = "404" ]; then
56+
echo "$(date +%FT%T%Z) [${probe_name}] - The Grid is not available or it might have /subPath configured. Please wait a moment or check the SE_SUB_PATH variable if needed."
57+
fi
58+
}
59+
2760
function signal_distributor_to_drain_node() {
2861
if [ "${DISTRIBUTED_MODE}" = true ]; then
29-
echo "Signaling Distributor to drain node"
30-
set -x
31-
curl -k -X POST ${SE_SERVER_PROTOCOL}://${SE_DISTRIBUTOR_HOST}:${SE_DISTRIBUTOR_PORT}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
32-
set +x
62+
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Distributor to drain node"
63+
curl -m ${max_time} -k -X POST ${SE_SERVER_PROTOCOL}://${SE_DISTRIBUTOR_HOST}:${SE_DISTRIBUTOR_PORT}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
3364
fi
3465
}
3566

3667
function signal_hub_to_drain_node() {
3768
if [ "${DISTRIBUTED_MODE}" = false ]; then
38-
echo "Signaling Hub to drain node"
39-
curl -k -X POST ${SE_GRID_URL}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
69+
get_grid_url
70+
if [ -n "${grid_url}" ]; then
71+
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Hub to drain node"
72+
curl -m ${max_time} -k -X POST ${grid_url}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
73+
fi
4074
fi
4175
}
4276

4377
function signal_node_to_drain() {
44-
echo "Signaling Node to drain itself"
45-
curl -k -X POST ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/se/grid/node/drain --header "${HEADERS}"
78+
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Node to drain itself"
79+
curl -m ${max_time} -k -X POST ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/se/grid/node/drain --header "${HEADERS}"
4680
}
4781

48-
function replace_localhost_by_service_name() {
49-
internal="${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}"
50-
echo "SE_NODE_GRID_URL: ${SE_NODE_GRID_URL}"
51-
if [[ "${SE_NODE_GRID_URL}" == *"/localhost"* ]]; then
52-
SE_GRID_URL=${SE_NODE_GRID_URL//localhost/${internal}}
53-
elif [[ "${SE_NODE_GRID_URL}" == *"/127.0.0.1"* ]]; then
54-
SE_GRID_URL=${SE_NODE_GRID_URL//127.0.0.1/${internal}}
55-
elif [[ "${SE_NODE_GRID_URL}" == *"/0.0.0.0"* ]]; then
56-
SE_GRID_URL=${SE_NODE_GRID_URL//0.0.0.0/${internal}}
57-
else
58-
SE_GRID_URL=${SE_NODE_GRID_URL}
59-
fi
60-
echo "Set SE_GRID_URL internally: ${SE_GRID_URL}"
61-
}
62-
replace_localhost_by_service_name
63-
64-
if curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status > /tmp/preStopOutput; then
65-
NODE_ID=$(jq -r '.value.node.nodeId' /tmp/preStopOutput)
82+
if curl -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status > ${tmp_node_file}; then
83+
NODE_ID=$(jq -r '.value.node.nodeId' ${tmp_node_file} || "")
6684
if [ -n "${NODE_ID}" ]; then
67-
echo "Current Node ID is: ${NODE_ID}"
68-
signal_hub_to_drain_node
85+
echo "$(date +%FT%T%Z) [${probe_name}] - Current Node ID is: ${NODE_ID}"
6986
signal_distributor_to_drain_node
87+
signal_hub_to_drain_node
7088
echo
7189
fi
7290
signal_node_to_drain
7391
# Wait for the current session to be finished if any
74-
while curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o /tmp/preStopOutput;
92+
while curl -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o ${tmp_node_file};
7593
do
76-
echo "Node preStop is waiting for current session to be finished if any. Node details: message: $(jq -r '.value.message' /tmp/preStopOutput || "unknown"), availability: $(jq -r '.value.node.availability' /tmp/preStopOutput || "unknown")"
77-
sleep 1;
94+
SLOT_HAS_SESSION=$(jq -e ".value.node.slots[]|select(.session != null).id.id" ${tmp_node_file} | tr -d '"' || "")
95+
if [ -z "${SLOT_HAS_SESSION}" ]; then
96+
echo "$(date +%FT%T%Z) [${probe_name}] - There is no session running. Node is ready to be terminated."
97+
echo "$(date +%FT%T%Z) [${probe_name}] - $(cat ${tmp_node_file} || "")"
98+
echo
99+
exit 0
100+
else
101+
echo "$(date +%FT%T%Z) [${probe_name}] - Node preStop is waiting for current session on slot ${SLOT_HAS_SESSION} to be finished. Node details: message: $(jq -r '.value.message' ${tmp_node_file} || "unknown"), availability: $(jq -r '.value.node.availability' ${tmp_node_file} || "unknown")"
102+
sleep 1;
103+
fi
78104
done
79105
else
80-
echo "Node is already drained. Shutting down gracefully!"
106+
echo "$(date +%FT%T%Z) [${probe_name}] - Node is already drained. Shutting down gracefully!"
81107
fi
Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,79 @@
11
#!/bin/bash
22

3+
max_time=3
4+
probe_name="Probe.${1:-"Startup"}"
5+
6+
ID=$(echo $RANDOM)
7+
tmp_node_file="/tmp/nodeProbe${ID}"
8+
tmp_grid_file="/tmp/gridProbe${ID}"
9+
310
function on_exit() {
4-
rm -rf /tmp/nodeProbe${ID}
5-
rm -rf /tmp/gridProbe${ID}
11+
rm -rf ${tmp_node_file}
12+
rm -rf ${tmp_grid_file}
613
}
714
trap on_exit EXIT
815

9-
ID=$(echo $RANDOM)
16+
function init_file() {
17+
echo "{}" > ${tmp_node_file}
18+
echo "{}" > ${tmp_grid_file}
19+
}
20+
init_file
1021

11-
function replace_localhost_by_service_name() {
12-
internal="${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}"
13-
echo "SE_NODE_GRID_URL: ${SE_NODE_GRID_URL}"
14-
if [[ "${SE_NODE_GRID_URL}" == *"/localhost"* ]]; then
15-
SE_GRID_URL=${SE_NODE_GRID_URL//localhost/${internal}}
16-
elif [[ "${SE_NODE_GRID_URL}" == *"/127.0.0.1"* ]]; then
17-
SE_GRID_URL=${SE_NODE_GRID_URL//127.0.0.1/${internal}}
18-
elif [[ "${SE_NODE_GRID_URL}" == *"/0.0.0.0"* ]]; then
19-
SE_GRID_URL=${SE_NODE_GRID_URL//0.0.0.0/${internal}}
20-
else
21-
SE_GRID_URL=${SE_NODE_GRID_URL}
22+
function help_message() {
23+
echo "$(date +%FT%T%Z) [${probe_name}] - If you believe Node is registered successfully but probe still report this message and fail for a long time. Workaround by set 'global.seleniumGrid.defaultNodeStartupProbe' to 'httpGet' and report us an issue for Chart improvement with your scenario."
24+
}
25+
26+
function get_grid_url() {
27+
if [ -z "${SE_HUB_HOST:-$SE_ROUTER_HOST}" ] || [ -z "${SE_HUB_PORT:-$SE_ROUTER_PORT}" ]; then
28+
echo "$(date +%FT%T%Z) [${probe_name}] - There is no configured HUB or ROUTER host. Probe ignores the registration checks on upstream."
29+
exit 0
30+
fi
31+
if [[ -n "${SE_BASIC_AUTH}" && "${SE_BASIC_AUTH}" != *@ ]]; then
32+
SE_BASIC_AUTH="${SE_BASIC_AUTH}@"
33+
fi
34+
if [ "${SE_SUB_PATH}" = "/" ]; then
35+
SE_SUB_PATH=""
36+
fi
37+
grid_url=${SE_SERVER_PROTOCOL}://${SE_BASIC_AUTH}${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}${SE_SUB_PATH}
38+
grid_url_checks=$(curl -m ${max_time} -skf -o /dev/null -w "%{http_code}" ${grid_url})
39+
if [ "${grid_url_checks}" = "401" ]; then
40+
echo "$(date +%FT%T%Z) [${probe_name}] - Host requires Basic Auth. Please add the credentials to the SE_BASIC_AUTH variable (e.g: user:password)."
41+
help_message
42+
exit 1
43+
fi
44+
if [ "${grid_url_checks}" = "404" ]; then
45+
echo "$(date +%FT%T%Z) [${probe_name}] - The Grid is not available or it might have /subPath configured. Please wait a moment or check the SE_SUB_PATH variable if needed."
46+
help_message
47+
exit 1
2248
fi
23-
echo "Set SE_GRID_URL internally: ${SE_GRID_URL}"
2449
}
25-
replace_localhost_by_service_name
2650

27-
if curl -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o /tmp/nodeProbe${ID}; then
28-
NODE_ID=$(jq -r '.value.node.nodeId' /tmp/nodeProbe${ID})
29-
NODE_STATUS=$(jq -r '.value.node.availability' /tmp/nodeProbe${ID})
51+
if curl -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o ${tmp_node_file}; then
52+
NODE_ID=$(jq -r '.value.node.nodeId' ${tmp_node_file} || "")
53+
NODE_STATUS=$(jq -r '.value.node.availability' ${tmp_node_file} || "")
3054
if [ -n "${NODE_ID}" ]; then
31-
echo "Node responds the ID: ${NODE_ID} with status: ${NODE_STATUS}"
55+
echo "$(date +%FT%T%Z) [${probe_name}] - Node responds the ID: ${NODE_ID} with status: ${NODE_STATUS}"
3256
else
33-
echo "Wait for the Node to report its status"
57+
echo "$(date +%FT%T%Z) [${probe_name}] - Wait for the Node to report its status"
3458
exit 1
3559
fi
3660

37-
curl -sfk "${SE_GRID_URL}/status" -o /tmp/gridProbe${ID}
38-
GRID_NODE_ID=$(jq -e ".value.nodes[].id|select(. == \"${NODE_ID}\")" /tmp/gridProbe${ID} | tr -d '"' || true)
61+
get_grid_url
62+
63+
curl -m ${max_time} -sfk "${grid_url}/status" -o ${tmp_grid_file}
64+
GRID_NODE_ID=$(jq -e ".value.nodes[].id|select(. == \"${NODE_ID}\")" ${tmp_grid_file} | tr -d '"' || "")
3965
if [ -n "${GRID_NODE_ID}" ]; then
40-
echo "Grid responds a matched Node ID: ${GRID_NODE_ID}"
66+
echo "$(date +%FT%T%Z) [${probe_name}] - Grid responds a matched Node ID: ${GRID_NODE_ID}"
4167
fi
4268

43-
if [ "${NODE_STATUS}" = "UP" ] && [ -n "${NODE_ID}" ] && [ -n "${GRID_NODE_ID}" ] && [ "${NODE_ID}" = "${GRID_NODE_ID}" ]; then
44-
echo "Node ID: ${NODE_ID} is found in the Grid. The registration is successful."
69+
if [ -n "${NODE_ID}" ] && [ -n "${GRID_NODE_ID}" ] && [ "${NODE_ID}" = "${GRID_NODE_ID}" ]; then
70+
echo "$(date +%FT%T%Z) [${probe_name}] - Node ID: ${NODE_ID} is found in the Grid. Node is ready."
4571
exit 0
4672
else
47-
echo "Node ID: ${NODE_ID} is not found in the Grid. The registration could be in progress."
73+
echo "$(date +%FT%T%Z) [${probe_name}] - Node ID: ${NODE_ID} is not found in the Grid. Node is not ready."
4874
exit 1
4975
fi
5076
else
51-
echo "Wait for the Node to report its status"
77+
echo "$(date +%FT%T%Z) [${probe_name}] - Wait for the Node to report its status"
5278
exit 1
5379
fi

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ Check user define custom probe method
3535
{{- $overrideProbe | toYaml -}}
3636
{{- end -}}
3737

38+
{{- define "seleniumGrid.probe.stdout" -}}
39+
{{- $stdout := "" -}}
40+
{{- if .Values.global.seleniumGrid.stdoutProbeLog -}}
41+
{{- $stdout = ">> /proc/1/fd/1" -}}
42+
{{- end -}}
43+
{{- $stdout -}}
44+
{{- end -}}
45+
3846
{{/*
3947
Get probe settings
4048
*/}}
@@ -155,8 +163,10 @@ Common autoscaling spec template
155163
{{- if not .Values.autoscaling.scaledOptions.triggers }}
156164
triggers:
157165
- type: selenium-grid
166+
metadata:
167+
triggerIndex: '{{ default $.Values.autoscaling.scaledOptions.minReplicaCount (.node.scaledOptions).minReplicaCount }}'
158168
{{- with .node.hpa }}
159-
metadata: {{- tpl (toYaml .) $ | nindent 6 }}
169+
{{- tpl (toYaml .) $ | nindent 6 }}
160170
{{- end }}
161171
{{- end }}
162172
{{- end -}}
@@ -207,6 +217,14 @@ template:
207217
value: {{ .name | quote }}
208218
- name: SE_NODE_PORT
209219
value: {{ .node.port | quote }}
220+
{{- with .node.startupProbe.timeoutSeconds }}
221+
- name: SE_NODE_REGISTER_PERIOD
222+
value: {{ . | quote }}
223+
{{- end }}
224+
{{- with .node.startupProbe.periodSeconds }}
225+
- name: SE_NODE_REGISTER_CYCLE
226+
value: {{ . | quote }}
227+
{{- end }}
210228
{{- with .node.extraEnvironmentVariables }}
211229
{{- tpl (toYaml .) $ | nindent 10 }}
212230
{{- end }}
@@ -268,7 +286,7 @@ template:
268286
{{- include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $) | nindent 10 }}
269287
{{- else if eq $.Values.global.seleniumGrid.defaultNodeStartupProbe "exec" }}
270288
exec:
271-
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodeProbe.sh >> /proc/1/fd/1"]
289+
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodeProbe.sh Startup {{ include "seleniumGrid.probe.stdout" $ }}"]
272290
{{- else }}
273291
httpGet:
274292
scheme: {{ default (include "seleniumGrid.probe.httpGet.schema" $) .schema }}
@@ -301,6 +319,9 @@ template:
301319
livenessProbe:
302320
{{- if (ne (include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $)) "{}") }}
303321
{{- include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $) | nindent 10 }}
322+
{{- else if eq $.Values.global.seleniumGrid.defaultNodeLivenessProbe "exec" }}
323+
exec:
324+
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodeProbe.sh Liveness {{ include "seleniumGrid.probe.stdout" $ }}"]
304325
{{- else }}
305326
httpGet:
306327
scheme: {{ default (include "seleniumGrid.probe.httpGet.schema" $) .schema }}
@@ -547,7 +568,7 @@ Define preStop hook for the node pod. Node preStop script is stored in a ConfigM
547568
{{- define "seleniumGrid.node.deregisterLifecycle" -}}
548569
preStop:
549570
exec:
550-
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh >> /proc/1/fd/1"]
571+
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodePreStop.sh {{ include "seleniumGrid.probe.stdout" $ }}"]
551572
{{- end -}}
552573

553574
{{/*

charts/selenium-grid/templates/node-configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ data:
2121
SE_HUB_HOST: '{{ include "seleniumGrid.hub.fullname" . }}.{{ .Release.Namespace }}'
2222
SE_HUB_PORT: '{{ .Values.hub.port }}'
2323
{{- end }}
24+
SE_BASIC_AUTH: '{{ template "seleniumGrid.url.basicAuth" $ }}'
25+
SE_SUB_PATH: '{{ template "seleniumGrid.url.subPath" $ }}'
2426
SE_DRAIN_AFTER_SESSION_COUNT: '{{- and (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "job") | ternary "1" "0" -}}'
2527
SE_NODE_GRID_URL: '{{ include "seleniumGrid.url" .}}'
2628
SE_NODE_GRID_GRAPHQL_URL: '{{ include "seleniumGrid.graphqlURL" . }}'

0 commit comments

Comments
 (0)