From 62ea271f36e711365b71442fec16f89ff00509e4 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Tue, 14 May 2024 05:45:29 +0000 Subject: [PATCH] fix(chart): upload.conf is missing in volumeMounts Signed-off-by: Viet Nguyen Duc --- charts/selenium-grid/Chart.yaml | 2 +- charts/selenium-grid/templates/_helpers.tpl | 4 ++-- tests/charts/templates/test.py | 25 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/charts/selenium-grid/Chart.yaml b/charts/selenium-grid/Chart.yaml index 809b3148a..fbcfb9746 100644 --- a/charts/selenium-grid/Chart.yaml +++ b/charts/selenium-grid/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: selenium-grid description: A Helm chart for creating a Selenium Grid Server in Kubernetes type: application -version: 0.30.1 +version: 0.30.2 appVersion: 4.20.0-20240505 icon: https://github.com/SeleniumHQ/docker-selenium/raw/trunk/logo.png dependencies: diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index 0df4c7e59..be74a65ee 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -382,7 +382,7 @@ template: name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }} - configMapRef: name: {{ template "seleniumGrid.server.configmap.fullname" $ }} - {{- if and $.Values.videoRecorder.uploader.enabled (not (empty $.Values.videoRecorder.uploader.name)) }} + {{- if and $.Values.videoRecorder.uploader.enabled (empty $.Values.videoRecorder.uploader.name) }} - secretRef: name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} {{- end }} @@ -647,7 +647,7 @@ Define terminationGracePeriodSeconds of the node pod. mountPath: {{ $.Values.recorderConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} -{{- if and $.Values.videoRecorder.uploader.enabled (not (empty $.Values.videoRecorder.uploader.name)) }} +{{- if and $.Values.videoRecorder.uploader.enabled (empty $.Values.videoRecorder.uploader.name) }} {{- range $fileName, $value := .Values.uploaderConfigMap.secretFiles }} - name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} mountPath: {{ $.Values.uploaderConfigMap.extraScriptsDirectory }}/{{ $fileName }} diff --git a/tests/charts/templates/test.py b/tests/charts/templates/test.py index fdc55d172..c729bbb38 100644 --- a/tests/charts/templates/test.py +++ b/tests/charts/templates/test.py @@ -183,6 +183,31 @@ def test_extra_script_import_to_recorder_configmap(self): count += 1 self.assertEqual(count, len(resources_name), "No recorder config resources found") + def test_upload_conf_mount_to_video_container(self): + resources_name = ['{0}selenium-chrome-node'.format(RELEASE_NAME), + '{0}selenium-edge-node'.format(RELEASE_NAME), + '{0}selenium-firefox-node'.format(RELEASE_NAME),] + is_present = False + for doc in LIST_OF_DOCUMENTS: + if doc['metadata']['name'] in resources_name and doc['kind'] == 'Deployment': + logger.info(f"Assert upload config is mounted to the container") + video_container = None + uploader_container = None + for container in doc['spec']['template']['spec']['containers']: + if container['name'] == 'video': + video_container = container + if container['name'] == 'uploader': + uploader_container = container + list_volume_mounts = None + if uploader_container is not None: + list_volume_mounts = uploader_container['volumeMounts'] + else: + list_volume_mounts = video_container['volumeMounts'] + for volume in list_volume_mounts: + if volume['mountPath'] == '/opt/bin/upload.conf': + is_present = True + self.assertTrue(is_present, "Volume mount for upload config is not present in the container") + def test_terminationGracePeriodSeconds_in_deployment_autoscaling(self): resources_name = ['{0}selenium-chrome-node'.format(RELEASE_NAME),] count = 0