From fe80abaaa28102ac2a8d24a844a229dad3dbccc1 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Fri, 27 Oct 2023 17:10:43 +0700 Subject: [PATCH] Improve default value for videoRecorder in chart (#1984) Signed-off-by: Viet Nguyen Duc --- charts/selenium-grid/templates/_helpers.tpl | 2 +- .../templates/chrome-node-deployment.yaml | 2 +- .../templates/chrome-node-scaledjobs.yaml | 2 +- .../selenium-grid/templates/edge-node-deployment.yaml | 2 +- .../selenium-grid/templates/edge-node-scaledjob.yaml | 2 +- .../templates/firefox-node-deployment.yaml | 2 +- .../templates/firefox-node-scaledjob.yaml | 2 +- charts/selenium-grid/templates/video-cm.yaml | 11 +++++++---- charts/selenium-grid/values.yaml | 8 +++++--- 9 files changed, 19 insertions(+), 14 deletions(-) diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index affe63635..3b95b017a 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -181,7 +181,7 @@ template: imagePullPolicy: {{ .Values.videoRecorder.imagePullPolicy }} env: - name: UPLOAD_DESTINATION_PREFIX - value: {{ .Values.videoRecorder.uploadDestinationPrefix }} + value: {{ .Values.videoRecorder.uploadDestinationPrefix | quote }} {{- with .Values.videoRecorder.extraEnvironmentVariables }} {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} diff --git a/charts/selenium-grid/templates/chrome-node-deployment.yaml b/charts/selenium-grid/templates/chrome-node-deployment.yaml index a89800fdf..4d9a30ac0 100644 --- a/charts/selenium-grid/templates/chrome-node-deployment.yaml +++ b/charts/selenium-grid/templates/chrome-node-deployment.yaml @@ -25,6 +25,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-chrome-node" -}} {{- $_ = set $podScope "node" .Values.chromeNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 2 }} {{- end }} diff --git a/charts/selenium-grid/templates/chrome-node-scaledjobs.yaml b/charts/selenium-grid/templates/chrome-node-scaledjobs.yaml index b5770e8a2..c72818b05 100644 --- a/charts/selenium-grid/templates/chrome-node-scaledjobs.yaml +++ b/charts/selenium-grid/templates/chrome-node-scaledjobs.yaml @@ -35,6 +35,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-chrome-node" -}} {{- $_ = set $podScope "node" .Values.chromeNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 4 }} {{- end }} diff --git a/charts/selenium-grid/templates/edge-node-deployment.yaml b/charts/selenium-grid/templates/edge-node-deployment.yaml index d81b7ef93..6216dc101 100644 --- a/charts/selenium-grid/templates/edge-node-deployment.yaml +++ b/charts/selenium-grid/templates/edge-node-deployment.yaml @@ -25,6 +25,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-edge-node" -}} {{- $_ = set $podScope "node" .Values.edgeNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 2 }} {{- end }} diff --git a/charts/selenium-grid/templates/edge-node-scaledjob.yaml b/charts/selenium-grid/templates/edge-node-scaledjob.yaml index 6083226e5..eae9ba79a 100644 --- a/charts/selenium-grid/templates/edge-node-scaledjob.yaml +++ b/charts/selenium-grid/templates/edge-node-scaledjob.yaml @@ -35,6 +35,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-edge-node" -}} {{- $_ = set $podScope "node" .Values.edgeNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 4 }} {{- end }} diff --git a/charts/selenium-grid/templates/firefox-node-deployment.yaml b/charts/selenium-grid/templates/firefox-node-deployment.yaml index 645986c11..13dcf904f 100644 --- a/charts/selenium-grid/templates/firefox-node-deployment.yaml +++ b/charts/selenium-grid/templates/firefox-node-deployment.yaml @@ -25,6 +25,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-firefox-node" -}} {{- $_ = set $podScope "node" .Values.firefoxNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 2 }} {{- end }} diff --git a/charts/selenium-grid/templates/firefox-node-scaledjob.yaml b/charts/selenium-grid/templates/firefox-node-scaledjob.yaml index 4ec26225a..3fceee4f5 100644 --- a/charts/selenium-grid/templates/firefox-node-scaledjob.yaml +++ b/charts/selenium-grid/templates/firefox-node-scaledjob.yaml @@ -35,6 +35,6 @@ spec: {{- $podScope := deepCopy . -}} {{- $_ := set $podScope "name" "selenium-firefox-node" -}} {{- $_ = set $podScope "node" .Values.firefoxNode -}} -{{- $_ = set $podScope "uploader" (get .Values.videoRecorder .Values.videoRecorder.uploader) -}} +{{- $_ = set $podScope "uploader" (get .Values.videoRecorder (.Values.videoRecorder.uploader | toString)) -}} {{- include "seleniumGrid.podTemplate" $podScope | nindent 4 }} {{- end }} diff --git a/charts/selenium-grid/templates/video-cm.yaml b/charts/selenium-grid/templates/video-cm.yaml index 400278720..e3ea227d5 100644 --- a/charts/selenium-grid/templates/video-cm.yaml +++ b/charts/selenium-grid/templates/video-cm.yaml @@ -67,7 +67,7 @@ data: if [[ "$session_id" != "null" && "$session_id" != "" && "$recording_started" = "false" ]] then video_file_name="$session_id.mp4" - video_file="${VIDEO_LOCATION:-/videos}/$video_file_name" + video_file="${SE_VIDEO_FOLDER:-/videos}/$video_file_name" echo "Starting to record video" ffmpeg -nostdin -y -f x11grab -video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p $video_file & recording_started="true" @@ -77,9 +77,12 @@ data: echo "Stopping to record video" kill -INT %1 fg || echo ffmpeg exited with code $? - upload_destination=${UPLOAD_DESTINATION_PREFIX}${video_file_name} - echo "Uploading video to $upload_destination" - echo $video_file $upload_destination > /videos/uploadpipe & + if [[ "$UPLOAD_DESTINATION_PREFIX" != "false" ]] + then + upload_destination=${UPLOAD_DESTINATION_PREFIX}${video_file_name} + echo "Uploading video to $upload_destination" + echo $video_file $upload_destination > /videos/uploadpipe & + fi recording_started="false" elif [[ $recording_started = "true" ]] then diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index 28eb115d4..cb773015e 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -730,9 +730,10 @@ videoRecorder: imageName: selenium/video enabled: false # Where to upload the video file. Should be set to something like 's3://myvideobucket/' - uploadDestinationPrefix: "" + uploadDestinationPrefix: false # What uploader to use. See .videRecorder.s3 for how to create a new one. - uploader: s3 + # uploader: s3 + uploader: false # Image of video recorder imageTag: latest @@ -749,7 +750,7 @@ videoRecorder: memory: "1Gi" cpu: "1" extraEnvironmentVariables: [] - # - name: VIDEO_LOCATION + # - name: SE_VIDEO_FOLDER # value: /videos # Custom environment variables by sourcing entire configMap, Secret, etc. for video recorder. extraEnvFrom: @@ -761,6 +762,7 @@ videoRecorder: terminationGracePeriodSeconds: 30 volume: emptyDir: {} + # Container spec for the uploader if above it is defined as "uploader: s3" s3: imageName: public.ecr.aws/bitnami/aws-cli imageTag: "2"