Skip to content

Commit

Permalink
Improve default value for videoRecorder in chart (#1984)
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <[email protected]>
  • Loading branch information
VietND96 authored Oct 27, 2023
1 parent 0f7367e commit fe80aba
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/chrome-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/chrome-node-scaledjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/edge-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/edge-node-scaledjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/firefox-node-scaledjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
11 changes: 7 additions & 4 deletions charts/selenium-grid/templates/video-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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"
Expand Down

0 comments on commit fe80aba

Please sign in to comment.