Skip to content

Commit 1f519c6

Browse files
authored
chart(update): update env vars and health check scripts (#2334)
1 parent 695a397 commit 1f519c6

22 files changed

+141
-145
lines changed

Diff for: Base/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ USER ${SEL_UID}:${SEL_GID}
144144
#======================================
145145
# Boolean value, maps "--bind-host"
146146
ENV SE_BIND_HOST=false \
147+
SE_SERVER_PROTOCOL="http" \
147148
# Boolean value, maps "--reject-unsupported-caps"
148149
SE_REJECT_UNSUPPORTED_CAPS=false \
149150
SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED=true \

Diff for: Hub/start-selenium-grid-hub.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ if [ ! -z "$SE_DISABLE_UI" ]; then
6161
SE_OPTS="$SE_OPTS --disable-ui ${SE_DISABLE_UI}"
6262
fi
6363

64-
if [ ! -z "$ROUTER_USERNAME" ]; then
65-
echo "Appending Selenium options: --username ${ROUTER_USERNAME}"
66-
SE_OPTS="$SE_OPTS --username ${ROUTER_USERNAME}"
64+
if [ ! -z "$SE_ROUTER_USERNAME" ]; then
65+
echo "Appending Selenium options: --username ${SE_ROUTER_USERNAME}"
66+
SE_OPTS="$SE_OPTS --username ${SE_ROUTER_USERNAME}"
6767
fi
6868

69-
if [ ! -z "$ROUTER_PASSWORD" ]; then
70-
echo "Appending Selenium options: --password ${ROUTER_PASSWORD}"
71-
SE_OPTS="$SE_OPTS --password ${ROUTER_PASSWORD}"
69+
if [ ! -z "$SE_ROUTER_PASSWORD" ]; then
70+
echo "Appending Selenium options: --password ${SE_ROUTER_PASSWORD}"
71+
SE_OPTS="$SE_OPTS --password ${SE_ROUTER_PASSWORD}"
7272
fi
7373

7474
if [ ! -z "$SE_REJECT_UNSUPPORTED_CAPS" ]; then

Diff for: NodeBase/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ ENV LANG_WHICH=${LANG_WHICH} \
5050
#============================
5151
# Some configuration options
5252
#============================
53-
SE_SCREEN_WIDTH=1360 \
54-
SE_SCREEN_HEIGHT=1020 \
53+
SE_SCREEN_WIDTH=1920 \
54+
SE_SCREEN_HEIGHT=1080 \
5555
SE_SCREEN_DEPTH=24 \
5656
SE_SCREEN_DPI=96 \
5757
SE_START_XVFB=true \

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ $ docker run -d -p 4444:4444 -e SE_SUB_PATH=/selenium-grid/ --name selenium-hub
10651065

10661066
### Setting Screen Resolution
10671067

1068-
By default, nodes start with a screen resolution of 1360 x 1020 with a color depth of 24 bits and a dpi of 96.
1068+
By default, nodes start with a screen resolution of 1920 x 1080 with a color depth of 24 bits and a dpi of 96.
10691069
These settings can be adjusted by specifying `SE_SCREEN_WIDTH`, `SE_SCREEN_HEIGHT`, `SE_SCREEN_DEPTH`, and/or `SE_SCREEN_DPI`
10701070
environmental variables when starting the container.
10711071

Diff for: Router/start-selenium-grid-router.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ if [ ! -z "$SE_DISABLE_UI" ]; then
9393
SE_OPTS="$SE_OPTS --disable-ui ${SE_DISABLE_UI}"
9494
fi
9595

96-
if [ ! -z "$ROUTER_USERNAME" ]; then
97-
echo "Appending Selenium options: --username ${ROUTER_USERNAME}"
98-
SE_OPTS="$SE_OPTS --username ${ROUTER_USERNAME}"
96+
if [ ! -z "$SE_ROUTER_USERNAME" ]; then
97+
echo "Appending Selenium options: --username ${SE_ROUTER_USERNAME}"
98+
SE_OPTS="$SE_OPTS --username ${SE_ROUTER_USERNAME}"
9999
fi
100100

101-
if [ ! -z "$ROUTER_PASSWORD" ]; then
102-
echo "Appending Selenium options: --password ${ROUTER_PASSWORD}"
103-
SE_OPTS="$SE_OPTS --password ${ROUTER_PASSWORD}"
101+
if [ ! -z "$SE_ROUTER_PASSWORD" ]; then
102+
echo "Appending Selenium options: --password ${SE_ROUTER_PASSWORD}"
103+
SE_OPTS="$SE_OPTS --password ${SE_ROUTER_PASSWORD}"
104104
fi
105105

106106
EXTRA_LIBS=""

Diff for: Standalone/start-selenium-standalone.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ if [ ! -z "$SE_DISABLE_UI" ]; then
2626
SE_OPTS="$SE_OPTS --disable-ui ${SE_DISABLE_UI}"
2727
fi
2828

29-
if [ ! -z "$ROUTER_USERNAME" ]; then
30-
echo "Appending Selenium options: --username ${ROUTER_USERNAME}"
31-
SE_OPTS="$SE_OPTS --username ${ROUTER_USERNAME}"
29+
if [ ! -z "$SE_ROUTER_USERNAME" ]; then
30+
echo "Appending Selenium options: --username ${SE_ROUTER_USERNAME}"
31+
SE_OPTS="$SE_OPTS --username ${SE_ROUTER_USERNAME}"
3232
fi
3333

34-
if [ ! -z "$ROUTER_PASSWORD" ]; then
35-
echo "Appending Selenium options: --password ${ROUTER_PASSWORD}"
36-
SE_OPTS="$SE_OPTS --password ${ROUTER_PASSWORD}"
34+
if [ ! -z "$SE_ROUTER_PASSWORD" ]; then
35+
echo "Appending Selenium options: --password ${SE_ROUTER_PASSWORD}"
36+
SE_OPTS="$SE_OPTS --password ${SE_ROUTER_PASSWORD}"
3737
fi
3838

3939
if [ ! -z "$SE_NODE_ENABLE_MANAGED_DOWNLOADS" ]; then

Diff for: Video/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ CMD ["/opt/bin/entry_point.sh"]
101101

102102
ENV DISPLAY_NUM=99 \
103103
DISPLAY_CONTAINER_NAME=selenium \
104-
SE_SCREEN_WIDTH=1360 \
105-
SE_SCREEN_HEIGHT=1020 \
104+
SE_SERVER_PROTOCOL="http" \
105+
SE_SCREEN_WIDTH=1920 \
106+
SE_SCREEN_HEIGHT=1080 \
106107
SE_FRAME_RATE=15 \
107108
SE_CODEC=libx264 \
108109
SE_PRESET="-preset ultrafast" \

Diff for: charts/selenium-grid/configs/distributor/distributorProbe.sh

+9-24
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,27 @@ max_time=3
44
retry_time=3
55
probe_name="Probe.${1:-"Liveness"}"
66
ts_format=${SE_LOG_TIMESTAMP_FORMAT:-"+%T.%3N"}
7+
ROUTER_CONFIG_DIRECTORY=${ROUTER_CONFIG_DIRECTORY:-"/opt/selenium"}
78

8-
if [ -n "${ROUTER_USERNAME}" ] && [ -n "${ROUTER_PASSWORD}" ]; then
9-
BASIC_AUTH="${ROUTER_USERNAME}:${ROUTER_PASSWORD}@"
10-
fi
11-
12-
if [[ ${SE_SUB_PATH} == */ ]]; then
13-
GRAPHQL_ENDPOINT="${SE_SUB_PATH}graphql"
14-
else
15-
GRAPHQL_ENDPOINT="${SE_SUB_PATH}/graphql"
16-
fi
17-
18-
if [[ ${GRAPHQL_ENDPOINT} == /* ]]; then
19-
GRAPHQL_ENDPOINT="${GRAPHQL_ENDPOINT}"
20-
else
21-
GRAPHQL_ENDPOINT="/${GRAPHQL_ENDPOINT}"
22-
fi
9+
GRID_GRAPHQL_URL=$(bash ${ROUTER_CONFIG_DIRECTORY}/routerGraphQLUrl.sh)
2310

24-
if [ -z "${SE_GRID_GRAPHQL_URL}" ] && [ -n "${SE_HUB_HOST:-${SE_ROUTER_HOST}}" ] && [ -n "${SE_HUB_PORT:-${SE_ROUTER_PORT}}" ]; then
25-
SE_GRID_GRAPHQL_URL="${SE_SERVER_PROTOCOL}://${BASIC_AUTH}${SE_HUB_HOST:-${SE_ROUTER_HOST}}:${SE_HUB_PORT:-${SE_ROUTER_PORT}}${GRAPHQL_ENDPOINT}"
26-
elif [ -z "${SE_GRID_GRAPHQL_URL}" ]; then
27-
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Could not construct GraphQL endpoint, it can be set directly via SE_GRID_GRAPHQL_URL. Bypass the probe checks for now."
11+
if [ -z "${GRID_GRAPHQL_URL}" ]; then
12+
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Could not construct GraphQL endpoint, please provide SE_HUB_HOST (or SE_ROUTER_HOST) and SE_HUB_PORT (or SE_ROUTER_PORT). Bypass the probe checks for now."
2813
exit 0
2914
fi
3015

31-
GRAPHQL_PRE_CHECK=$(curl --noproxy "*" -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionCount } }"}' -s -o /dev/null -w "%{http_code}" ${SE_GRID_GRAPHQL_URL})
16+
GRAPHQL_PRE_CHECK=$(curl --noproxy "*" -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionCount } }"}' -s -o /dev/null -w "%{http_code}" ${GRID_GRAPHQL_URL})
3217

3318
if [ ${GRAPHQL_PRE_CHECK} -ne 200 ]; then
34-
echo "$(date ${ts_format}) DEBUG [${probe_name}] - GraphQL endpoint ${SE_GRID_GRAPHQL_URL} is not reachable. Status code: ${GRAPHQL_PRE_CHECK}."
19+
echo "$(date ${ts_format}) DEBUG [${probe_name}] - GraphQL endpoint ${GRID_GRAPHQL_URL} is not reachable. Status code: ${GRAPHQL_PRE_CHECK}."
3520
exit 1
3621
fi
3722

38-
SESSION_QUEUE_SIZE=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionQueueSize } }"}' -s ${SE_GRID_GRAPHQL_URL} | jq -r '.data.grid.sessionQueueSize')
23+
SESSION_QUEUE_SIZE=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionQueueSize } }"}' -s ${GRID_GRAPHQL_URL} | jq -r '.data.grid.sessionQueueSize')
3924

40-
SESSION_COUNT=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query": "{ grid { sessionCount } }"}' -s ${SE_GRID_GRAPHQL_URL} | jq -r '.data.grid.sessionCount')
25+
SESSION_COUNT=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query": "{ grid { sessionCount } }"}' -s ${GRID_GRAPHQL_URL} | jq -r '.data.grid.sessionCount')
4126

42-
MAX_SESSION=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { maxSession } }"}' -s ${SE_GRID_GRAPHQL_URL} | jq -r '.data.grid.maxSession')
27+
MAX_SESSION=$(curl --noproxy "*" --retry ${retry_time} -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { maxSession } }"}' -s ${GRID_GRAPHQL_URL} | jq -r '.data.grid.maxSession')
4328

4429
if [ ${SESSION_QUEUE_SIZE} -gt 0 ] && [ ${SESSION_COUNT} -eq 0 ]; then
4530
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Session Queue Size: ${SESSION_QUEUE_SIZE}, Session Count: ${SESSION_COUNT}, Max Session: ${MAX_SESSION}"

Diff for: charts/selenium-grid/configs/node/nodeGridUrl.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
max_time=3
4+
5+
if [ -z "${SE_HUB_HOST:-$SE_ROUTER_HOST}" ] || [ -z "${SE_HUB_PORT:-$SE_ROUTER_PORT}" ]; then
6+
grid_url=""
7+
else
8+
if [ -n "${SE_ROUTER_USERNAME}" ] && [ -n "${SE_ROUTER_PASSWORD}" ]; then
9+
BASIC_AUTH="${SE_ROUTER_USERNAME}:${SE_ROUTER_PASSWORD}@"
10+
fi
11+
if [ "${SE_SUB_PATH}" = "/" ]; then
12+
SE_SUB_PATH=""
13+
fi
14+
grid_url=${SE_SERVER_PROTOCOL}://${BASIC_AUTH}${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}${SE_SUB_PATH}
15+
fi
16+
17+
if [ -z "${grid_url}" ]; then
18+
grid_url="${SE_NODE_GRID_URL}"
19+
fi
20+
21+
if [ -z "${grid_url}" ]; then
22+
return 0
23+
fi
24+
25+
grid_url_checks=$(curl --noproxy "*" -m ${max_time} -s -k -o /dev/null -w "%{http_code}" ${grid_url})
26+
if [ "${grid_url_checks}" = "401" ]; then
27+
return ${grid_url_checks}
28+
fi
29+
if [ "${grid_url_checks}" = "404" ]; then
30+
return ${grid_url_checks}
31+
fi
32+
33+
echo "${grid_url}"

Diff for: charts/selenium-grid/configs/node/nodePreStop.sh

+7-47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
probe_name="lifecycle.${1:-"preStop"}"
4+
NODE_CONFIG_DIRECTORY=${NODE_CONFIG_DIRECTORY:-"/opt/selenium"}
45

56
max_time=3
67
retry_time=5
@@ -26,53 +27,13 @@ else
2627
HEADERS="X-REGISTRATION-SECRET;"
2728
fi
2829

29-
function is_full_distributed_mode() {
30-
if [ -n "${SE_DISTRIBUTOR_HOST}" ] && [ -n "${SE_DISTRIBUTOR_PORT}" ]; then
31-
DISTRIBUTED_MODE=true
32-
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"
33-
else
34-
DISTRIBUTED_MODE=false
35-
echo "$(date +%FT%T%Z) [${probe_name}] - Detected full distributed mode: ${DISTRIBUTED_MODE}"
36-
fi
37-
}
38-
is_full_distributed_mode
39-
40-
function get_grid_url() {
41-
if [ -z "${SE_HUB_HOST:-$SE_ROUTER_HOST}" ] || [ -z "${SE_HUB_PORT:-$SE_ROUTER_PORT}" ]; then
42-
echo "$(date +%FT%T%Z) [${probe_name}] - There is no configured HUB or ROUTER host. preStop ignores to send drain request to upstream."
43-
grid_url=""
44-
fi
45-
if [ -n "${SE_BASIC_AUTH}" ] && [ "${SE_BASIC_AUTH}" != "*@" ]; then
46-
SE_BASIC_AUTH="${SE_BASIC_AUTH}@"
47-
fi
48-
if [ "${SE_SUB_PATH}" = "/" ]; then
49-
SE_SUB_PATH=""
50-
fi
51-
grid_url=${SE_SERVER_PROTOCOL}://${SE_BASIC_AUTH}${SE_HUB_HOST:-$SE_ROUTER_HOST}:${SE_HUB_PORT:-$SE_ROUTER_PORT}${SE_SUB_PATH}
52-
grid_url_checks=$(curl --noproxy "*" -m ${max_time} -s -o /dev/null -w "%{http_code}" ${grid_url})
53-
if [ "${grid_url_checks}" = "401" ]; then
54-
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."
55-
grid_url=""
56-
fi
57-
if [ "${grid_url_checks}" = "404" ]; then
58-
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."
59-
fi
60-
}
61-
62-
function signal_distributor_to_drain_node() {
63-
if [ "${DISTRIBUTED_MODE}" = true ]; then
64-
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Distributor to drain node"
65-
curl --noproxy "*" -m ${max_time} -k -X POST ${SE_SERVER_PROTOCOL}://${SE_DISTRIBUTOR_HOST}:${SE_DISTRIBUTOR_PORT}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
66-
fi
67-
}
68-
6930
function signal_hub_to_drain_node() {
70-
if [ "${DISTRIBUTED_MODE}" = false ]; then
71-
get_grid_url
72-
if [ -n "${grid_url}" ]; then
73-
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Hub to drain node"
74-
curl --noproxy "*" -m ${max_time} -k -X POST ${grid_url}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
75-
fi
31+
grid_url=$(bash ${NODE_CONFIG_DIRECTORY}/nodeGridUrl.sh)
32+
if [ -n "${grid_url}" ]; then
33+
echo "$(date +%FT%T%Z) [${probe_name}] - Signaling Hub/Router to drain node"
34+
curl --noproxy "*" -m ${max_time} -k -X POST ${grid_url}/se/grid/distributor/node/${NODE_ID}/drain --header "${HEADERS}"
35+
else
36+
echo "$(date +%FT%T%Z) [${probe_name}] - There is no configured HUB/ROUTER host or SE_NODE_GRID_URL isn't set. preStop ignores to send drain request to upstream."
7637
fi
7738
}
7839

@@ -85,7 +46,6 @@ if curl --noproxy "*" -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE
8546
NODE_ID=$(jq -r '.value.node.nodeId' ${tmp_node_file} || "")
8647
if [ -n "${NODE_ID}" ]; then
8748
echo "$(date +%FT%T%Z) [${probe_name}] - Current Node ID is: ${NODE_ID}"
88-
signal_distributor_to_drain_node
8949
signal_hub_to_drain_node
9050
echo
9151
fi

Diff for: charts/selenium-grid/configs/node/nodeProbe.sh

+2-26
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
max_time=3
44
probe_name="Probe.${1:-"Startup"}"
5+
NODE_CONFIG_DIRECTORY=${NODE_CONFIG_DIRECTORY:-"/opt/selenium"}
56

67
ID=$(echo $RANDOM)
78
tmp_node_file="/tmp/nodeProbe${ID}"
@@ -23,31 +24,6 @@ function help_message() {
2324
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."
2425
}
2526

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 --noproxy "*" -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
48-
fi
49-
}
50-
5127
if curl --noproxy "*" -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE_NODE_PORT}/status -o ${tmp_node_file}; then
5228
NODE_ID=$(jq -r '.value.node.nodeId' ${tmp_node_file} || "")
5329
NODE_STATUS=$(jq -r '.value.node.availability' ${tmp_node_file} || "")
@@ -58,7 +34,7 @@ if curl --noproxy "*" -m ${max_time} -sfk ${SE_SERVER_PROTOCOL}://127.0.0.1:${SE
5834
exit 1
5935
fi
6036

61-
get_grid_url
37+
grid_url=$(bash ${NODE_CONFIG_DIRECTORY}/nodeGridUrl.sh)
6238

6339
curl --noproxy "*" -m ${max_time} -sfk "${grid_url}/status" -o ${tmp_grid_file}
6440
GRID_NODE_ID=$(jq -e ".value.nodes[].id|select(. == \"${NODE_ID}\")" ${tmp_grid_file} | tr -d '"' || "")
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
if [ -z "${SE_HUB_HOST:-$SE_ROUTER_HOST}" ] || [ -z "${SE_HUB_PORT:-$SE_ROUTER_PORT}" ]; then
4+
graphql_url=""
5+
else
6+
if [ -n "${SE_ROUTER_USERNAME}" ] && [ -n "${SE_ROUTER_PASSWORD}" ]; then
7+
BASIC_AUTH="${SE_ROUTER_USERNAME}:${SE_ROUTER_PASSWORD}@"
8+
fi
9+
10+
if [[ ${SE_SUB_PATH} == */ ]]; then
11+
GRAPHQL_ENDPOINT="${SE_SUB_PATH}graphql"
12+
else
13+
GRAPHQL_ENDPOINT="${SE_SUB_PATH}/graphql"
14+
fi
15+
16+
if [[ ${GRAPHQL_ENDPOINT} == /* ]]; then
17+
GRAPHQL_ENDPOINT="${GRAPHQL_ENDPOINT}"
18+
else
19+
GRAPHQL_ENDPOINT="/${GRAPHQL_ENDPOINT}"
20+
fi
21+
22+
graphql_url="${SE_SERVER_PROTOCOL}://${BASIC_AUTH}${SE_HUB_HOST:-${SE_ROUTER_HOST}}:${SE_HUB_PORT:-${SE_ROUTER_PORT}}${GRAPHQL_ENDPOINT}"
23+
fi
24+
25+
echo "${graphql_url}"

Diff for: charts/selenium-grid/configs/router/routerProbe.sh

+6-21
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,19 @@ max_time=3
44
retry_time=3
55
probe_name="Probe.${1:-"Liveness"}"
66
ts_format=${SE_LOG_TIMESTAMP_FORMAT:-"+%T.%3N"}
7+
ROUTER_CONFIG_DIRECTORY=${ROUTER_CONFIG_DIRECTORY:-"/opt/selenium"}
78

8-
if [ -n "${ROUTER_USERNAME}" ] && [ -n "${ROUTER_PASSWORD}" ]; then
9-
BASIC_AUTH="${ROUTER_USERNAME}:${ROUTER_PASSWORD}@"
10-
fi
11-
12-
if [[ ${SE_SUB_PATH} == */ ]]; then
13-
GRAPHQL_ENDPOINT="${SE_SUB_PATH}graphql"
14-
else
15-
GRAPHQL_ENDPOINT="${SE_SUB_PATH}/graphql"
16-
fi
17-
18-
if [[ ${GRAPHQL_ENDPOINT} == /* ]]; then
19-
GRAPHQL_ENDPOINT="${GRAPHQL_ENDPOINT}"
20-
else
21-
GRAPHQL_ENDPOINT="/${GRAPHQL_ENDPOINT}"
22-
fi
9+
GRID_GRAPHQL_URL=$(bash ${ROUTER_CONFIG_DIRECTORY}/routerGraphQLUrl.sh)
2310

24-
if [ -z "${SE_GRID_GRAPHQL_URL}" ] && [ -n "${SE_HUB_HOST:-${SE_ROUTER_HOST}}" ] && [ -n "${SE_HUB_PORT:-${SE_ROUTER_PORT}}" ]; then
25-
SE_GRID_GRAPHQL_URL="${SE_SERVER_PROTOCOL}://${BASIC_AUTH}${SE_HUB_HOST:-${SE_ROUTER_HOST}}:${SE_HUB_PORT:-${SE_ROUTER_PORT}}${GRAPHQL_ENDPOINT}"
26-
elif [ -z "${SE_GRID_GRAPHQL_URL}" ]; then
27-
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Could not construct GraphQL endpoint, it can be set directly via SE_GRID_GRAPHQL_URL. Bypass the probe checks for now."
11+
if [ -z "${GRID_GRAPHQL_URL}" ]; then
12+
echo "$(date ${ts_format}) DEBUG [${probe_name}] - Could not construct GraphQL endpoint, please provide SE_HUB_HOST (or SE_ROUTER_HOST) and SE_HUB_PORT (or SE_ROUTER_PORT). Bypass the probe checks for now."
2813
exit 0
2914
fi
3015

31-
GRAPHQL_PRE_CHECK=$(curl --noproxy "*" -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionCount } }"}' -s -o /dev/null -w "%{http_code}" ${SE_GRID_GRAPHQL_URL})
16+
GRAPHQL_PRE_CHECK=$(curl --noproxy "*" -m ${max_time} -k -X POST -H "Content-Type: application/json" --data '{"query":"{ grid { sessionCount } }"}' -s -o /dev/null -w "%{http_code}" ${GRID_GRAPHQL_URL})
3217

3318
if [ ${GRAPHQL_PRE_CHECK} -ne 200 ]; then
34-
echo "$(date ${ts_format}) DEBUG [${probe_name}] - GraphQL endpoint ${SE_GRID_GRAPHQL_URL} is not reachable. Status code: ${GRAPHQL_PRE_CHECK}."
19+
echo "$(date ${ts_format}) DEBUG [${probe_name}] - GraphQL endpoint is not reachable. Status code: ${GRAPHQL_PRE_CHECK}."
3520
exit 1
3621
else
3722
echo "$(date ${ts_format}) DEBUG [${probe_name}] - GraphQL endpoint is healthy."

Diff for: charts/selenium-grid/templates/distributor-configmap.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ metadata:
1212
{{- toYaml . | nindent 4 }}
1313
{{- end }}
1414
data:
15-
SE_GRID_GRAPHQL_URL: '{{ include "seleniumGrid.graphqlURL" $ }}'
1615
{{- $fileProceeded := list -}}
1716
{{- range $path, $_ := .Files.Glob $.Values.distributorConfigMap.extraScriptsImportFrom }}
1817
{{- $fileName := base $path -}}

0 commit comments

Comments
 (0)