Skip to content

K8s: Node enable readiness probe checks status registered to Hub #2833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| global.seleniumGrid.imagePullSecret | string | `""` | Pull secret for all components, can be overridden individually |
| global.seleniumGrid.logLevel | string | `"INFO"` | Log level for all components. Possible values describe here: https://www.selenium.dev/documentation/grid/configuration/cli_options/#logging |
| global.seleniumGrid.defaultNodeStartupProbe | string | `"exec"` | Set default startup probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet |
| global.seleniumGrid.defaultNodeReadinessProbe | string | `"exec"` | Set default readiness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet |
| global.seleniumGrid.defaultNodeLivenessProbe | string | `"exec"` | Set default readiness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet |
| global.seleniumGrid.defaultComponentLivenessProbe | string | `"exec"` | Set default liveness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet |
| global.seleniumGrid.stdoutProbeLog | bool | `false` | Probe logs output can be retrieved using `kubectl logs`. Noted: this will not work if shareProcessNamespace is enabled |
Expand Down Expand Up @@ -147,6 +148,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| nodeConfigMap.extraScripts."nodeGridUrl.sh" | string | `""` | |
| nodeConfigMap.extraScripts."nodePreStop.sh" | string | `""` | |
| nodeConfigMap.extraScripts."nodeProbe.sh" | string | `""` | |
| nodeConfigMap.extraScripts."nodeProbeReadiness.sh" | string | `""` | |
| nodeConfigMap.scriptVolumeMountName | string | `nil` | Name of volume mount is used to mount scripts in the ConfigMap |
| nodeConfigMap.leftoversCleanup.enabled | bool | `false` | Enable feature automatic browser leftovers cleanup stuck browser processes, tmp files |
| nodeConfigMap.leftoversCleanup.jobIntervalInSecs | int | `3600` | Interval in seconds to run the cleanup job |
Expand Down Expand Up @@ -454,7 +456,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| chromeNode.dshmVolumeSizeLimit | string | `""` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
| chromeNode.priorityClassName | string | `""` | Priority class name for chrome-node pods |
| chromeNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
| chromeNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| chromeNode.readinessProbe | object | `{"enabled":true,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| chromeNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
| chromeNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
| chromeNode.deregisterLifecycle | string | `nil` | Define preStop command to shut down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle |
Expand Down Expand Up @@ -512,7 +514,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| firefoxNode.dshmVolumeSizeLimit | string | `"2Gi"` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
| firefoxNode.priorityClassName | string | `""` | Priority class name for firefox-node pods |
| firefoxNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
| firefoxNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| firefoxNode.readinessProbe | object | `{"enabled":true,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| firefoxNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
| firefoxNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
| firefoxNode.deregisterLifecycle | string | `nil` | Define preStop command to shuts down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle |
Expand Down Expand Up @@ -570,7 +572,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| edgeNode.dshmVolumeSizeLimit | string | `""` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
| edgeNode.priorityClassName | string | `""` | Priority class name for edge-node pods |
| edgeNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
| edgeNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| edgeNode.readinessProbe | object | `{"enabled":true,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| edgeNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
| edgeNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
| edgeNode.deregisterLifecycle | string | `nil` | Define preStop command to shuts down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle |
Expand Down Expand Up @@ -629,7 +631,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| relayNode.dshmVolumeSizeLimit | string | `""` | Size limit for DSH volume mounted in container (if not set, default is disabled, e.g "1Gi") |
| relayNode.priorityClassName | string | `""` | Priority class name for relay-node pods |
| relayNode.startupProbe | object | `{"enabled":true,"failureThreshold":12,"initialDelaySeconds":0,"path":"/status","periodSeconds":5,"successThreshold":1,"timeoutSeconds":60}` | Startup probe settings |
| relayNode.readinessProbe | object | `{"enabled":false,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| relayNode.readinessProbe | object | `{"enabled":true,"failureThreshold":10,"initialDelaySeconds":10,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}` | Readiness probe settings |
| relayNode.livenessProbe | object | `{"enabled":false,"failureThreshold":6,"initialDelaySeconds":30,"path":"/status","periodSeconds":10,"successThreshold":1,"timeoutSeconds":60}` | Liveness probe settings |
| relayNode.terminationGracePeriodSeconds | int | `30` | Time to wait for pod termination |
| relayNode.deregisterLifecycle | string | `nil` | Define preStop command to shut down the relay node gracefully. This overwrites autoscaling.deregisterLifecycle |
Expand Down
16 changes: 16 additions & 0 deletions charts/selenium-grid/configs/node/nodeProbeReadiness.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

probe_name="Probe.${1:-"Readiness"}"
ts_format=${SE_LOG_TIMESTAMP_FORMAT:-"%Y-%m-%d %H:%M:%S,%3N"}
ENDPOINT="${SE_SERVER_PROTOCOL:-"http"}://localhost:${SE_NODE_PORT:-"5555"}/status"

response=$(curl -skSL --noproxy "*" "${ENDPOINT}")

# Validate the JSON response
# From v4.31.0 - [grid] Expose register status via Node status response (#15448)
if echo "$response" | jq -e '.value.registered == true' > /dev/null; then
echo "$(date -u +"${ts_format}") [${probe_name}] - Readiness check passed: Node is registered."
else
echo "$(date -u +"${ts_format}") [${probe_name}] - Readiness check failed: Node is not registered."
exit 1
fi
5 changes: 4 additions & 1 deletion charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,10 @@ template:
{{- with .node.readinessProbe }}
readinessProbe:
{{- if (ne (include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $)) "{}") }}
{{- include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $) | nindent 12 }}
{{- include "seleniumGrid.probe.fromUserDefine" (dict "values" . "root" $) | nindent 10 }}
{{- else if eq $.Values.global.seleniumGrid.defaultNodeReadinessProbe "exec" }}
exec:
command: ["bash", "-c", "{{ $.Values.nodeConfigMap.extraScriptsDirectory }}/nodeProbeReadiness.sh Readiness {{ include "seleniumGrid.probe.stdout" $ }}"]
{{- else }}
httpGet:
scheme: {{ default (include "seleniumGrid.probe.httpGet.schema" $) .schema }}
Expand Down
12 changes: 8 additions & 4 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ global:
# -- Set default startup probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet
defaultNodeStartupProbe: exec
# -- Set default readiness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet
defaultNodeReadinessProbe: exec
# -- Set default readiness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet
defaultNodeLivenessProbe: exec
# -- Set default liveness probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet
defaultComponentLivenessProbe: exec
Expand Down Expand Up @@ -328,6 +330,8 @@ nodeConfigMap:
nodePreStop.sh: ""
# -- Key to set contents for script file via --set-file
nodeProbe.sh: ""
# -- Key to set contents for script file via --set-file
nodeProbeReadiness.sh: ""
# -- Name of volume mount is used to mount scripts in the ConfigMap
scriptVolumeMountName:
leftoversCleanup:
Expand Down Expand Up @@ -1235,7 +1239,7 @@ chromeNode:

# -- Readiness probe settings
readinessProbe:
enabled: false
enabled: true
path: /status
initialDelaySeconds: 10
failureThreshold: 10
Expand Down Expand Up @@ -1431,7 +1435,7 @@ firefoxNode:

# -- Readiness probe settings
readinessProbe:
enabled: false
enabled: true
path: /status
initialDelaySeconds: 10
failureThreshold: 10
Expand Down Expand Up @@ -1627,7 +1631,7 @@ edgeNode:

# -- Readiness probe settings
readinessProbe:
enabled: false
enabled: true
path: /status
initialDelaySeconds: 10
failureThreshold: 10
Expand Down Expand Up @@ -1824,7 +1828,7 @@ relayNode:

# -- Readiness probe settings
readinessProbe:
enabled: false
enabled: true
path: /status
initialDelaySeconds: 10
failureThreshold: 10
Expand Down
Loading