Skip to content

K8s: Video recorder run as sidecar container is disabled by default #2843

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 26, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ chart_test_autoscaling_job:
./tests/charts/make/chart_test.sh JobAutoscaling

chart_test_autoscaling_playwright_connect_grid:
PLATFORMS=$(PLATFORMS) CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_BASIC_AUTH=true TEST_EXTERNAL_DATASTORE=redis MATRIX_TESTS=CDPTests TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_MULTIPLE_PLATFORMS=true \
PLATFORMS=$(PLATFORMS) CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_BASIC_AUTH=true TEST_EXTERNAL_DATASTORE=redis MATRIX_TESTS=CDPTests TEST_PATCHED_KEDA=$(TEST_PATCHED_KEDA) TEST_MULTIPLE_PLATFORMS=true TEST_VIDEO_RECORDER_SIDECAR=true \
BASIC_AUTH_USERNAME=docker-selenium BASIC_AUTH_PASSWORD=2NMI4jdBi6k7bENoeUfV25295VvzwAE9chM24a+2VL95uOHozo \
SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 \
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \
Expand Down
1 change: 1 addition & 0 deletions charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| relayNode.sidecars | list | `[]` | It is used to add sidecars proxy in the same pod of the browser node. It means it will add a new container to the deployment itself. It should be set using the --set-json option |
| relayNode.videoRecorder | object | `{}` | Override specific video recording settings for edge node |
| videoRecorder.enabled | bool | `false` | Enable video recording in all browser nodes |
| videoRecorder.sidecarContainer | bool | `false` | Video recorder run as a sidecar container (2 containers in the same pod), or a single container with browser and recorder https://github.com/SeleniumHQ/docker-selenium/discussions/2539 |
| videoRecorder.name | string | `"video"` | Container name is set to resource specs |
| videoRecorder.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
| videoRecorder.imageName | string | `"video"` | Image of video recorder |
Expand Down
8 changes: 8 additions & 0 deletions charts/selenium-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,14 @@ videoRecorder:
enabled: true
```

From chart version `0.44.0+`, by default, the video recorder is not running as sidecar container anymore. Recording function will be performed in browser node container itself (check out the [implementation](https://github.com/SeleniumHQ/docker-selenium/discussions/2539)).
If you want to enable the video recorder as a sidecar container, you can set the following values:

```yaml
videoRecorder:
sidecarContainer: true
```

At chart deployment level, that config will enable video container always. In addition, you can disable video recording process via session capability `se:recordVideo`. For example in Python binding:

```python
Expand Down
70 changes: 43 additions & 27 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ template:
{{- with .node.securityContext }}
securityContext: {{- toYaml . | nindent 10 }}
{{- end }}
{{- if .recorder.enabled }}
{{- if (and .recorder.enabled .recorder.sidecarContainer) }}
- name: "pre-puller-{{ .recorder.name }}"
image: {{ printf "%s/%s:%s" $videoImageRegistry .recorder.imageName $videoImageTag }}
command: ["bash", "-c", "'true'"]
Expand Down Expand Up @@ -408,6 +408,10 @@ template:
value: {{ $nodeRegisterPeriod | quote }}
- name: SE_NODE_REGISTER_CYCLE
value: {{ $nodeRegisterCycle | quote }}
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
- name: SE_RECORD_VIDEO
value: "true"
{{- end }}
{{- with .node.extraEnvironmentVariables }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
Expand All @@ -422,12 +426,21 @@ template:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
- secretRef:
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
- configMapRef:
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
{{- end }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- with .node.extraEnvFrom }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
{{- with .recorder.extraEnvFrom }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: {{ .node.port }}
Expand All @@ -448,6 +461,9 @@ template:
- name: dshm
mountPath: /dev/shm
{{- end }}
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 10 }}
{{- end }}
{{- range $fileName, $value := $.Values.nodeConfigMap.extraScripts }}
- name: {{ tpl (default (include "seleniumGrid.node.configmap.fullname" $) $.Values.nodeConfigMap.scriptVolumeMountName) $ }}
mountPath: {{ $.Values.nodeConfigMap.extraScriptsDirectory }}/{{ $fileName }}
Expand Down Expand Up @@ -528,7 +544,7 @@ template:
{{- if .node.sidecars }}
{{- toYaml .node.sidecars | nindent 6 }}
{{- end }}
{{- if .recorder.enabled }}
{{- if (and .recorder.enabled .recorder.sidecarContainer) }}
- name: {{ .recorder.name }}
image: {{ printf "%s/%s:%s" $videoImageRegistry .recorder.imageName $videoImageTag }}
imagePullPolicy: {{ .recorder.imagePullPolicy }}
Expand All @@ -547,25 +563,25 @@ template:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.node.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
- secretRef:
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
{{- end }}
{{- with .recorder.extraEnvFrom }}
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
- configMapRef:
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.node.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
- configMapRef:
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
{{- if $.Values.basicAuth.enabled }}
- secretRef:
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
{{- end }}
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
- secretRef:
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
{{- end }}
{{- with .recorder.extraEnvFrom }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- if gt (len .recorder.ports) 0 }}
ports:
{{- range .recorder.ports }}
Expand All @@ -574,11 +590,11 @@ template:
{{- end }}
{{- end }}
volumeMounts:
{{- if not (empty .node.dshmVolumeSizeLimit) }}
- name: dshm
mountPath: /dev/shm
{{- end }}
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 8 }}
{{- if not (empty .node.dshmVolumeSizeLimit) }}
- name: dshm
mountPath: /dev/shm
{{- end }}
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 10 }}
{{- with .recorder.resources }}
resources: {{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
3 changes: 3 additions & 0 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,9 @@ relayNode:
videoRecorder:
# -- Enable video recording in all browser nodes
enabled: false
# -- Video recorder run as a sidecar container (2 containers in the same pod), or a single container with browser and recorder
# https://github.com/SeleniumHQ/docker-selenium/discussions/2539
sidecarContainer: false
# -- Container name is set to resource specs
name: video
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)
Expand Down
7 changes: 7 additions & 0 deletions tests/charts/make/chart_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT:-"true"}
TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS:-"false"}
TEST_MULTIPLE_PLATFORMS_RELAY=${TEST_MULTIPLE_PLATFORMS_RELAY:-"false"}
TEST_CUSTOM_SPECIFIC_NAME=${TEST_CUSTOM_SPECIFIC_NAME:-"false"}
TEST_VIDEO_RECORDER_SIDECAR=${TEST_VIDEO_RECORDER_SIDECAR:-"false"}

wait_for_terminated() {
# Wait until no pods are in "Terminating" state
Expand Down Expand Up @@ -409,6 +410,12 @@ if [ "${EXTERNAL_UPLOADER_CONFIG}" = "true" ]; then
"
fi

if [ "${TEST_VIDEO_RECORDER_SIDECAR}" = "true" ]; then
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
--set videoRecorder.sidecarContainer=true
"
fi

HELM_COMMAND_SET_BASE_VALUES="${HELM_COMMAND_SET_BASE_VALUES} \
--values ${TEST_VALUES_PATH}/base-auth-ingress-values.yaml \
--values ${RECORDER_VALUES_FILE} \
Expand Down
1 change: 1 addition & 0 deletions tests/charts/templates/render/dummy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ relayNode:

videoRecorder:
enabled: true
sidecarContainer: true
uploader:
enabled: true
name: s3
Expand Down
1 change: 1 addition & 0 deletions tests/charts/templates/render/dummy_solution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ selenium-grid:

videoRecorder:
enabled: true
sidecarContainer: true
uploader:
enabled: true
destinationPrefix: "s3://bucket-name"
Expand Down
Loading