Skip to content

Commit cc36ea9

Browse files
authored
K8s: Video recorder run as sidecar container is disabled by default (#2843)
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 9cd69ce commit cc36ea9

File tree

8 files changed

+65
-28
lines changed

8 files changed

+65
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ chart_test_autoscaling_job:
10251025
./tests/charts/make/chart_test.sh JobAutoscaling
10261026

10271027
chart_test_autoscaling_playwright_connect_grid:
1028-
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 \
1028+
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 \
10291029
BASIC_AUTH_USERNAME=docker-selenium BASIC_AUTH_PASSWORD=2NMI4jdBi6k7bENoeUfV25295VvzwAE9chM24a+2VL95uOHozo \
10301030
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 \
10311031
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) \

charts/selenium-grid/CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
655655
| 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 |
656656
| relayNode.videoRecorder | object | `{}` | Override specific video recording settings for edge node |
657657
| videoRecorder.enabled | bool | `false` | Enable video recording in all browser nodes |
658+
| 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 |
658659
| videoRecorder.name | string | `"video"` | Container name is set to resource specs |
659660
| videoRecorder.imageRegistry | string | `nil` | Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter) |
660661
| videoRecorder.imageName | string | `"video"` | Image of video recorder |

charts/selenium-grid/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,14 @@ videoRecorder:
683683
enabled: true
684684
```
685685

686+
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)).
687+
If you want to enable the video recorder as a sidecar container, you can set the following values:
688+
689+
```yaml
690+
videoRecorder:
691+
sidecarContainer: true
692+
```
693+
686694
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:
687695

688696
```python

charts/selenium-grid/templates/_helpers.tpl

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ template:
337337
{{- with .node.securityContext }}
338338
securityContext: {{- toYaml . | nindent 10 }}
339339
{{- end }}
340-
{{- if .recorder.enabled }}
340+
{{- if (and .recorder.enabled .recorder.sidecarContainer) }}
341341
- name: "pre-puller-{{ .recorder.name }}"
342342
image: {{ printf "%s/%s:%s" $videoImageRegistry .recorder.imageName $videoImageTag }}
343343
command: ["bash", "-c", "'true'"]
@@ -408,6 +408,10 @@ template:
408408
value: {{ $nodeRegisterPeriod | quote }}
409409
- name: SE_NODE_REGISTER_CYCLE
410410
value: {{ $nodeRegisterCycle | quote }}
411+
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
412+
- name: SE_RECORD_VIDEO
413+
value: "true"
414+
{{- end }}
411415
{{- with .node.extraEnvironmentVariables }}
412416
{{- tpl (toYaml .) $ | nindent 10 }}
413417
{{- end }}
@@ -422,12 +426,21 @@ template:
422426
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
423427
- secretRef:
424428
name: {{ template "seleniumGrid.common.secrets.fullname" $ }}
429+
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
430+
- configMapRef:
431+
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
432+
{{- end }}
425433
{{- if $.Values.basicAuth.enabled }}
426434
- secretRef:
427435
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
428436
{{- end }}
429437
{{- with .node.extraEnvFrom }}
430-
{{- tpl (toYaml .) $ | nindent 10 }}
438+
{{- tpl (toYaml .) $ | nindent 10 }}
439+
{{- end }}
440+
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
441+
{{- with .recorder.extraEnvFrom }}
442+
{{- tpl (toYaml .) $ | nindent 10 }}
443+
{{- end }}
431444
{{- end }}
432445
ports:
433446
- containerPort: {{ .node.port }}
@@ -448,6 +461,9 @@ template:
448461
- name: dshm
449462
mountPath: /dev/shm
450463
{{- end }}
464+
{{- if (and .recorder.enabled (not .recorder.sidecarContainer)) }}
465+
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 10 }}
466+
{{- end }}
451467
{{- range $fileName, $value := $.Values.nodeConfigMap.extraScripts }}
452468
- name: {{ tpl (default (include "seleniumGrid.node.configmap.fullname" $) $.Values.nodeConfigMap.scriptVolumeMountName) $ }}
453469
mountPath: {{ $.Values.nodeConfigMap.extraScriptsDirectory }}/{{ $fileName }}
@@ -528,7 +544,7 @@ template:
528544
{{- if .node.sidecars }}
529545
{{- toYaml .node.sidecars | nindent 6 }}
530546
{{- end }}
531-
{{- if .recorder.enabled }}
547+
{{- if (and .recorder.enabled .recorder.sidecarContainer) }}
532548
- name: {{ .recorder.name }}
533549
image: {{ printf "%s/%s:%s" $videoImageRegistry .recorder.imageName $videoImageTag }}
534550
imagePullPolicy: {{ .recorder.imagePullPolicy }}
@@ -547,25 +563,25 @@ template:
547563
{{- tpl (toYaml .) $ | nindent 8 }}
548564
{{- end }}
549565
envFrom:
550-
- configMapRef:
551-
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
552-
- configMapRef:
553-
name: {{ template "seleniumGrid.node.configmap.fullname" $ }}
554-
- configMapRef:
555-
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
556-
- configMapRef:
557-
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
558-
{{- if $.Values.basicAuth.enabled }}
559-
- secretRef:
560-
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
561-
{{- end }}
562-
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
563-
- secretRef:
564-
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
565-
{{- end }}
566-
{{- with .recorder.extraEnvFrom }}
567-
{{- tpl (toYaml .) $ | nindent 8 }}
568-
{{- end }}
566+
- configMapRef:
567+
name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }}
568+
- configMapRef:
569+
name: {{ template "seleniumGrid.node.configmap.fullname" $ }}
570+
- configMapRef:
571+
name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }}
572+
- configMapRef:
573+
name: {{ template "seleniumGrid.server.configmap.fullname" $ }}
574+
{{- if $.Values.basicAuth.enabled }}
575+
- secretRef:
576+
name: {{ template "seleniumGrid.basicAuth.secrets.fullname" $ }}
577+
{{- end }}
578+
{{- if and .recorder.uploader.enabled (empty .recorder.uploader.name) }}
579+
- secretRef:
580+
name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }}
581+
{{- end }}
582+
{{- with .recorder.extraEnvFrom }}
583+
{{- tpl (toYaml .) $ | nindent 10 }}
584+
{{- end }}
569585
{{- if gt (len .recorder.ports) 0 }}
570586
ports:
571587
{{- range .recorder.ports }}
@@ -574,11 +590,11 @@ template:
574590
{{- end }}
575591
{{- end }}
576592
volumeMounts:
577-
{{- if not (empty .node.dshmVolumeSizeLimit) }}
578-
- name: dshm
579-
mountPath: /dev/shm
580-
{{- end }}
581-
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 8 }}
593+
{{- if not (empty .node.dshmVolumeSizeLimit) }}
594+
- name: dshm
595+
mountPath: /dev/shm
596+
{{- end }}
597+
{{- tpl (include "seleniumGrid.video.volumeMounts" .) $ | nindent 10 }}
582598
{{- with .recorder.resources }}
583599
resources: {{- toYaml . | nindent 10 }}
584600
{{- end }}

charts/selenium-grid/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,9 @@ relayNode:
19081908
videoRecorder:
19091909
# -- Enable video recording in all browser nodes
19101910
enabled: false
1911+
# -- Video recorder run as a sidecar container (2 containers in the same pod), or a single container with browser and recorder
1912+
# https://github.com/SeleniumHQ/docker-selenium/discussions/2539
1913+
sidecarContainer: false
19111914
# -- Container name is set to resource specs
19121915
name: video
19131916
# -- Registry to pull the image (this overwrites global.seleniumGrid.imageRegistry parameter)

tests/charts/make/chart_test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ TEST_MULTIPLE_VERSIONS_EXPLICIT=${TEST_MULTIPLE_VERSIONS_EXPLICIT:-"true"}
6868
TEST_MULTIPLE_PLATFORMS=${TEST_MULTIPLE_PLATFORMS:-"false"}
6969
TEST_MULTIPLE_PLATFORMS_RELAY=${TEST_MULTIPLE_PLATFORMS_RELAY:-"false"}
7070
TEST_CUSTOM_SPECIFIC_NAME=${TEST_CUSTOM_SPECIFIC_NAME:-"false"}
71+
TEST_VIDEO_RECORDER_SIDECAR=${TEST_VIDEO_RECORDER_SIDECAR:-"false"}
7172

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

413+
if [ "${TEST_VIDEO_RECORDER_SIDECAR}" = "true" ]; then
414+
HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \
415+
--set videoRecorder.sidecarContainer=true
416+
"
417+
fi
418+
412419
HELM_COMMAND_SET_BASE_VALUES="${HELM_COMMAND_SET_BASE_VALUES} \
413420
--values ${TEST_VALUES_PATH}/base-auth-ingress-values.yaml \
414421
--values ${RECORDER_VALUES_FILE} \

tests/charts/templates/render/dummy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ relayNode:
166166

167167
videoRecorder:
168168
enabled: true
169+
sidecarContainer: true
169170
uploader:
170171
enabled: true
171172
name: s3

tests/charts/templates/render/dummy_solution.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ selenium-grid:
155155

156156
videoRecorder:
157157
enabled: true
158+
sidecarContainer: true
158159
uploader:
159160
enabled: true
160161
destinationPrefix: "s3://bucket-name"

0 commit comments

Comments
 (0)