From 3e45b59f325eaf611513245f5e869a1d979a2295 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Tue, 13 Feb 2024 04:54:15 +0700 Subject: [PATCH] update(chart): objects name convention with prefix is chart RELEASENAME (#2134) Signed-off-by: Viet Nguyen Duc --- charts/selenium-grid/README.md | 16 +- charts/selenium-grid/templates/_helpers.tpl | 203 +++--------------- .../selenium-grid/templates/_nameHelpers.tpl | 173 +++++++++++++++ .../templates/chrome-node-hpa.yaml | 2 +- .../templates/distributor-deployment.yaml | 8 +- .../templates/edge-node-hpa.yaml | 2 +- .../templates/event-bus-configmap.yaml | 2 +- .../templates/event-bus-deployment.yaml | 6 +- .../templates/firefox-node-hpa.yaml | 2 +- .../templates/hub-deployment.yaml | 6 +- .../templates/logging-configmap.yaml | 2 +- .../templates/node-configmap.yaml | 2 +- .../templates/recorder-configmap.yaml | 2 +- .../templates/router-deployment.yaml | 6 +- charts/selenium-grid/templates/secrets.yaml | 2 +- .../templates/server-configmap.yaml | 2 +- .../templates/session-map-deployment.yaml | 8 +- .../templates/session-queuer-deployment.yaml | 6 +- .../templates/uploader-configmap.yaml | 2 +- charts/selenium-grid/values.yaml | 56 +++-- tests/SeleniumTests/__init__.py | 4 +- tests/charts/ci/base-recorder-values.yaml | 5 + tests/charts/ci/base-tls-values.yaml | 5 - tests/charts/make/chart_test.sh | 12 +- tests/charts/templates/render/dummy.yaml | 4 + tests/charts/templates/test.py | 7 + 26 files changed, 289 insertions(+), 256 deletions(-) create mode 100644 charts/selenium-grid/templates/_nameHelpers.tpl diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index f7c1af3bb..9248b7b1c 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -628,12 +628,12 @@ This table contains the configuration parameters of the chart and their default | `basicAuth.username` | `admin` | Username of basic auth for Selenium Grid | | `basicAuth.password` | `admin` | Password of basic auth for Selenium Grid | | `isolateComponents` | `false` | Deploy Router, Distributor, EventBus, SessionMap and Nodes separately | -| `serviceAccount.create` | `true` | Enable or disable creation of service account (if `false`, `serviceAccount.name` MUST be specified | -| `serviceAccount.name` | `""` | Name of the service account to be made or existing service account to use for all deployments and jobs | +| `serviceAccount.create` | `true` | Enable or disable creation of service account (if `false`, `serviceAccount.nameOverride` MUST be specified | +| `serviceAccount.nameOverride` | `""` | Name of another service account to be made or existing service account to use for all deployments and jobs | | `serviceAccount.annotations` | `{}` | Custom annotations for service account | -| `busConfigMap.name` | `selenium-event-bus-config` | Name of the configmap that contains SE_EVENT_BUS_HOST, SE_EVENT_BUS_PUBLISH_PORT and SE_EVENT_BUS_SUBSCRIBE_PORT variables | +| `busConfigMap.nameOverride` | `` | Override another configmap that contains SE_EVENT_BUS_HOST, SE_EVENT_BUS_PUBLISH_PORT and SE_EVENT_BUS_SUBSCRIBE_PORT vars | | `busConfigMap.annotations` | `{}` | Custom annotations for configmap | -| `nodeConfigMap.name` | `selenium-node-config` | Name of the configmap that contains common environment variables for browser nodes | +| `nodeConfigMap.nameOverride` | `` | Name of the configmap that contains common environment variables for browser nodes | | `nodeConfigMap.annotations` | `{}` | Custom annotations for configmap | | `ingress.enabled` | `true` | Enable or disable ingress resource | | `ingress.className` | `""` | Name of ingress class to select which controller will implement ingress resource | @@ -794,7 +794,7 @@ This table contains the configuration parameters of the chart and their default | `videoRecorder.imagePullPolicy` | `IfNotPresent` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) | | `videoRecorder.uploader.enabled` | `false` | Enable the uploader for videos | | `videoRecorder.uploader.destinationPrefix` | `` | Destination for uploading video file. It is following `rclone` config | -| `videoRecorder.uploader.name` | `rclone` | Name of the uploader to use. Supported default `rclone` | +| `videoRecorder.uploader.name` | `` | Name of the pluggable uploader container to add and configure | | `videoRecorder.uploader.configFileName` | `config.conf` | Config file name for `rclone` in uploader container | | `videoRecorder.uploader.entryPointFileName` | `entry_point.sh` | Script file name for uploader container entry point | | `videoRecorder.uploader.config` | `` | Set value to uploader config file via YAML or `--set-file` | @@ -808,14 +808,8 @@ This table contains the configuration parameters of the chart and their default | `videoRecorder.startupProbe` | `{}` | Probe to check pod is started successfully | | `videoRecorder.livenessProbe` | `{}` | Liveness probe settings | | `videoRecorder.lifecycle` | `{}` | Define lifecycle events for video recorder | -| `videoRecorder.volume.name.folder` | `video` | Name is used to set for the volume to persist and share output video folder in container | -| `videoRecorder.volume.name.scripts` | `video-scripts` | Name is used to set for the volume to persist and share video recorder scripts in container | | `videoRecorder.extraVolumeMounts` | `[]` | Extra mounts of declared ExtraVolumes into pod | | `videoRecorder.extraVolumes` | `[]` | Extra Volumes declarations to be used in the pod (can be any supported volume type: ConfigMap, Secret, PVC, NFS, etc.) | -| `videoRecorder.rclone` | `See values.yaml` | Container spec for the uploader if `videoRecorder.uploader` is `s3`. Similarly, create for your new uploader | -| `videoRecorder.rclone.resources | `See values.yaml` | Resources for video uploader | -| `videoRecorder.rclone.extraEnvFrom` | `` | Custom environment taken from `configMap` or `secret` variables for video uploader | -| `videoRecorder.rclone.extraVolumeMounts` | `[]` | Extra mounts of declared ExtraVolumes into pod of video uploader | | `customLabels` | `{}` | Custom labels for k8s resources | | `ingress-nginx.enabled` | `false` | Enable the dependency chart Ingress controller for Kubernetes (https://github.com/kubernetes/ingress-nginx) | diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index a7514110c..ce8a954b1 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -1,113 +1,3 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "seleniumGrid.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -*/}} -{{- define "seleniumGrid.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "seleniumGrid.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "seleniumGrid.commonLabels" -}} -app.kubernetes.io/managed-by: {{ .Release.Service | lower }} -app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/version: {{ .Chart.AppVersion }} -app.kubernetes.io/component: {{ printf "selenium-grid-%s" .Chart.AppVersion }} -helm.sh/chart: {{ include "seleniumGrid.chart" . }} -{{- end -}} - -{{/* -Selenium Hub fullname -*/}} -{{- define "seleniumGrid.hub.fullname" -}} -{{- tpl (default (printf "%s-selenium-hub" .Release.Name) .Values.hub.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Event bus fullname -*/}} -{{- define "seleniumGrid.eventBus.fullname" -}} -{{- tpl (default (printf "%s-selenium-event-bus" .Release.Name) .Values.components.eventBus.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Router fullname -*/}} -{{- define "seleniumGrid.router.fullname" -}} -{{- tpl (default (printf "%s-selenium-router" .Release.Name) .Values.components.router.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Distributor fullname -*/}} -{{- define "seleniumGrid.distributor.fullname" -}} -{{- tpl (default (printf "%s-selenium-distributor" .Release.Name) .Values.components.distributor.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -SessionMap fullname -*/}} -{{- define "seleniumGrid.sessionMap.fullname" -}} -{{- tpl (default (printf "%s-selenium-session-map" .Release.Name) .Values.components.sessionMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -SessionQueue fullname -*/}} -{{- define "seleniumGrid.sessionQueue.fullname" -}} -{{- tpl (default (printf "%s-selenium-session-queue" .Release.Name) .Values.components.sessionQueue.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Chrome node fullname -*/}} -{{- define "seleniumGrid.chromeNode.fullname" -}} -{{- tpl (default (printf "%s-selenium-chrome-node" .Release.Name) .Values.chromeNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Firefox node fullname -*/}} -{{- define "seleniumGrid.firefoxNode.fullname" -}} -{{- tpl (default (printf "%s-selenium-firefox-node" .Release.Name) .Values.firefoxNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Edge node fullname -*/}} -{{- define "seleniumGrid.edgeNode.fullname" -}} -{{- tpl (default (printf "%s-selenium-edge-node" .Release.Name) .Values.edgeNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Ingress fullname -*/}} -{{- define "seleniumGrid.ingress.fullname" -}} -{{- tpl (default (printf "%s-selenium-ingress" .Release.Name) .Values.ingress.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} {{/* Protocol of server components @@ -166,13 +56,6 @@ Get probe settings {{- $settings | toYaml -}} {{- end -}} -{{/* -Secret TLS fullname -*/}} -{{- define "seleniumGrid.tls.fullname" -}} -{{- ( tpl (default (printf "%s-selenium-tls-secret" .Release.Name) .Values.tls.nameOverride) $ )| trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{/* Is registration secret enabled */}} @@ -193,13 +76,6 @@ Get default certificate file name in chart {{- $content -}} {{- end -}} -{{/* -Common secrets cross components -*/}} -{{- define "seleniumGrid.common.secrets" -}} -{{- tpl (default (printf "%s-selenium-secrets" .Release.Name) .Values.secrets.nameOverride) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{- define "seleniumGrid.ingress.nginx.annotations.default" -}} {{- with .Values.ingress.nginx }} {{- with .proxyTimeout }} @@ -227,27 +103,6 @@ nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" {{- end }} {{- end -}} -{{/* -Service Account fullname -*/}} -{{- define "seleniumGrid.serviceAccount.fullname" -}} -{{- tpl (.Values.serviceAccount.name | default (printf "%s-selenium-serviceaccount" .Release.Name)) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Recorder ConfigMap fullname -*/}} -{{- define "seleniumGrid.recorder.fullname" -}} -{{- tpl (default (printf "%s-selenium-recorder-config" .Release.Name) .Values.recorderConfigMap.name) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Uploader ConfigMap fullname -*/}} -{{- define "seleniumGrid.uploader.fullname" -}} -{{- tpl (default (printf "%s-selenium-uploader-config" .Release.Name) .Values.uploaderConfigMap.name) $ | trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{/* Is autoscaling using KEDA enabled */}} @@ -274,7 +129,7 @@ Common autoscaling spec template {{- with .node.scaledObjectOptions -}} {{- $spec = mergeOverwrite ($spec | fromYaml) . | toYaml -}} {{- end -}} - {{- $spec = mergeOverwrite ($spec | fromYaml) (dict "scaleTargetRef" (dict "name" .name)) | toYaml -}} + {{- $spec = mergeOverwrite ($spec | fromYaml) (dict "scaleTargetRef" (dict "name" .name) "advanced" (dict "horizontalPodAutoscalerConfig" (dict "name" .name))) | toYaml -}} {{- else if eq .Values.autoscaling.scalingType "job" -}} {{- with .Values.autoscaling.scaledJobOptions -}} {{- $spec = mergeOverwrite ($spec | fromYaml) . | toYaml -}} @@ -324,10 +179,10 @@ template: {{- with .node.hostAliases }} hostAliases: {{ toYaml . | nindent 6 }} {{- end }} + {{- with .node.initContainers }} initContainers: - {{- if .node.initContainers }} - {{- toYaml .node.initContainers | nindent 6 }} - {{- end }} + {{- toYaml . | nindent 6 }} + {{- end }} containers: - name: {{.name}} {{- $imageTag := default .Values.global.seleniumGrid.nodesImageTag .node.imageTag }} @@ -342,15 +197,15 @@ template: {{- end }} envFrom: - configMapRef: - name: {{ tpl (toYaml .Values.busConfigMap.name) $ }} + name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.nodeConfigMap.name) $ }} + name: {{ template "seleniumGrid.node.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.loggingConfigMap.name) $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.serverConfigMap.name) $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" $ }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ }} + name: {{ include "seleniumGrid.common.secrets.fullname" $ }} {{- with .node.extraEnvFrom }} {{- tpl (toYaml .) $ | nindent 10 }} {{- end }} @@ -372,7 +227,7 @@ template: - name: dshm mountPath: /dev/shm {{- range $fileName, $value := .Values.nodeConfigMap.extraScripts }} - - name: {{ $.Values.nodeConfigMap.scriptVolumeMountName }} + - name: {{ tpl (default (include "seleniumGrid.node.configmap.fullname" $) $.Values.nodeConfigMap.scriptVolumeMountName) $ }} mountPath: {{ $.Values.nodeConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} @@ -460,16 +315,16 @@ template: {{- end }} envFrom: - configMapRef: - name: {{ tpl (toYaml .Values.busConfigMap.name) $ }} + name: {{ template "seleniumGrid.eventBus.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.nodeConfigMap.name) $ }} + name: {{ template "seleniumGrid.node.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.recorderConfigMap.name) $ }} + name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }} - configMapRef: - name: {{ tpl (toYaml .Values.serverConfigMap.name) $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" $ }} {{- if and .Values.videoRecorder.uploader.enabled (not .Values.videoRecorder.uploader.name) }} - secretRef: - name: {{ tpl (toYaml .Values.uploaderConfigMap.secretVolumeMountName) $ }} + name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) .Values.uploaderConfigMap.secretVolumeMountName) $ }} {{- end }} {{- with .Values.videoRecorder.extraEnvFrom }} {{- tpl (toYaml .) $ | nindent 8 }} @@ -521,9 +376,9 @@ template: {{- end }} envFrom: - configMapRef: - name: {{ tpl (toYaml .Values.uploaderConfigMap.name) $ }} + name: {{ template "seleniumGrid.uploader.configmap.fullname" $ }} - secretRef: - name: {{ tpl (toYaml .Values.uploaderConfigMap.secretVolumeMountName) $ }} + name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) .Values.uploaderConfigMap.secretVolumeMountName) $ }} {{- with .uploader.extraEnvFrom }} {{- tpl (toYaml .) $ | nindent 10 }} {{- end }} @@ -556,9 +411,9 @@ template: {{- end }} terminationGracePeriodSeconds: {{ .node.terminationGracePeriodSeconds }} volumes: - - name: {{ .Values.nodeConfigMap.scriptVolumeMountName }} + - name: {{ tpl (default (include "seleniumGrid.node.configmap.fullname" $) $.Values.nodeConfigMap.scriptVolumeMountName) $ }} configMap: - name: {{ tpl .Values.nodeConfigMap.name $ }} + name: {{ template "seleniumGrid.node.configmap.fullname" $ }} defaultMode: {{ .Values.nodeConfigMap.defaultMode }} - name: dshm emptyDir: @@ -726,13 +581,13 @@ Define terminationGracePeriodSeconds of the node pod. {{- define "seleniumGrid.video.volumeMounts.default" -}} {{- range $fileName, $value := .Values.recorderConfigMap.extraScripts }} -- name: {{ tpl (toYaml $.Values.recorderConfigMap.scriptVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.recorder.configmap.fullname" $) $.Values.recorderConfigMap.scriptVolumeMountName) $ }} mountPath: {{ $.Values.recorderConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} {{- if and .Values.videoRecorder.uploader.enabled (not .Values.videoRecorder.uploader.name) }} {{- range $fileName, $value := .Values.uploaderConfigMap.secretFiles }} -- name: {{ tpl (toYaml $.Values.uploaderConfigMap.secretVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} mountPath: {{ $.Values.uploaderConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} @@ -744,27 +599,27 @@ Define terminationGracePeriodSeconds of the node pod. {{- define "seleniumGrid.video.volumes.default" -}} - name: {{ tpl (toYaml $.Values.recorderConfigMap.videoVolumeMountName) $ }} emptyDir: {} -- name: {{ tpl (toYaml $.Values.recorderConfigMap.scriptVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.recorder.configmap.fullname" $) $.Values.recorderConfigMap.scriptVolumeMountName) $ }} configMap: - name: {{ tpl (toYaml $.Values.recorderConfigMap.name) $ }} + name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }} defaultMode: {{ $.Values.recorderConfigMap.defaultMode }} -- name: {{ tpl (toYaml $.Values.uploaderConfigMap.scriptVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.uploader.configmap.fullname" $) $.Values.uploaderConfigMap.scriptVolumeMountName) $ }} configMap: - name: {{ tpl (toYaml $.Values.uploaderConfigMap.name) $ }} + name: {{ template "seleniumGrid.uploader.configmap.fullname" $ }} defaultMode: {{ $.Values.uploaderConfigMap.defaultMode }} -- name: {{ tpl (toYaml $.Values.uploaderConfigMap.secretVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} secret: - secretName: {{ tpl (toYaml $.Values.uploaderConfigMap.secretVolumeMountName) $ }} + secretName: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} {{- end -}} {{- define "seleniumGrid.video.uploader.volumeMounts.default" -}} {{- range $fileName, $value := .Values.uploaderConfigMap.extraScripts }} -- name: {{ tpl (toYaml $.Values.uploaderConfigMap.scriptVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.uploader.configmap.fullname" $) $.Values.uploaderConfigMap.scriptVolumeMountName) $ }} mountPath: {{ $.Values.uploaderConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} {{- range $fileName, $value := .Values.uploaderConfigMap.secretFiles }} -- name: {{ tpl (toYaml $.Values.uploaderConfigMap.secretVolumeMountName) $ }} +- name: {{ tpl (default (include "seleniumGrid.common.secrets.fullname" $) $.Values.uploaderConfigMap.secretVolumeMountName) $ }} mountPath: {{ $.Values.uploaderConfigMap.extraScriptsDirectory }}/{{ $fileName }} subPath: {{ $fileName }} {{- end }} diff --git a/charts/selenium-grid/templates/_nameHelpers.tpl b/charts/selenium-grid/templates/_nameHelpers.tpl new file mode 100644 index 000000000..b7d5abc2f --- /dev/null +++ b/charts/selenium-grid/templates/_nameHelpers.tpl @@ -0,0 +1,173 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "seleniumGrid.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "seleniumGrid.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "seleniumGrid.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "seleniumGrid.commonLabels" -}} +app.kubernetes.io/managed-by: {{ .Release.Service | lower }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/version: {{ .Chart.AppVersion }} +app.kubernetes.io/component: {{ printf "selenium-grid-%s" .Chart.AppVersion }} +helm.sh/chart: {{ include "seleniumGrid.chart" . }} +{{- end -}} + +{{/* +Selenium Hub fullname +*/}} +{{- define "seleniumGrid.hub.fullname" -}} +{{- tpl (default (printf "%s-selenium-hub" .Release.Name) .Values.hub.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Event bus fullname +*/}} +{{- define "seleniumGrid.eventBus.fullname" -}} +{{- tpl (default (printf "%s-selenium-event-bus" .Release.Name) .Values.components.eventBus.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Event bus ConfigMap fullname +*/}} +{{- define "seleniumGrid.eventBus.configmap.fullname" -}} +{{- tpl (default (include "seleniumGrid.eventBus.fullname" $) .Values.busConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Router fullname +*/}} +{{- define "seleniumGrid.router.fullname" -}} +{{- tpl (default (printf "%s-selenium-router" .Release.Name) .Values.components.router.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Distributor fullname +*/}} +{{- define "seleniumGrid.distributor.fullname" -}} +{{- tpl (default (printf "%s-selenium-distributor" .Release.Name) .Values.components.distributor.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +SessionMap fullname +*/}} +{{- define "seleniumGrid.sessionMap.fullname" -}} +{{- tpl (default (printf "%s-selenium-session-map" .Release.Name) .Values.components.sessionMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +SessionQueue fullname +*/}} +{{- define "seleniumGrid.sessionQueue.fullname" -}} +{{- tpl (default (printf "%s-selenium-session-queue" .Release.Name) .Values.components.sessionQueue.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Chrome node fullname +*/}} +{{- define "seleniumGrid.chromeNode.fullname" -}} +{{- tpl (default (printf "%s-selenium-chrome-node" .Release.Name) .Values.chromeNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Firefox node fullname +*/}} +{{- define "seleniumGrid.firefoxNode.fullname" -}} +{{- tpl (default (printf "%s-selenium-firefox-node" .Release.Name) .Values.firefoxNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Edge node fullname +*/}} +{{- define "seleniumGrid.edgeNode.fullname" -}} +{{- tpl (default (printf "%s-selenium-edge-node" .Release.Name) .Values.edgeNode.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Ingress fullname +*/}} +{{- define "seleniumGrid.ingress.fullname" -}} +{{- tpl (default (printf "%s-selenium-ingress" .Release.Name) .Values.ingress.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common secrets cross components +*/}} +{{- define "seleniumGrid.common.secrets.fullname" -}} +{{- tpl (default (printf "%s-selenium-secrets" .Release.Name) .Values.secrets.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Secret TLS fullname +*/}} +{{- define "seleniumGrid.tls.fullname" -}} +{{- tpl (default (printf "%s-selenium-tls-secret" .Release.Name) .Values.tls.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Service Account fullname +*/}} +{{- define "seleniumGrid.serviceAccount.fullname" -}} +{{- tpl (default (printf "%s-selenium-serviceaccount" .Release.Name) .Values.serviceAccount.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Recorder ConfigMap fullname +*/}} +{{- define "seleniumGrid.recorder.configmap.fullname" -}} +{{- tpl (default (printf "%s-selenium-recorder-config" .Release.Name) .Values.recorderConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Uploader ConfigMap fullname +*/}} +{{- define "seleniumGrid.uploader.configmap.fullname" -}} +{{- tpl (default (printf "%s-selenium-uploader-config" .Release.Name) .Values.uploaderConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Logging ConfigMap fullname +*/}} +{{- define "seleniumGrid.logging.configmap.fullname" -}} +{{- tpl (default (printf "%s-selenium-logging-config" .Release.Name) .Values.loggingConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Node ConfigMap fullname +*/}} +{{- define "seleniumGrid.node.configmap.fullname" -}} +{{- tpl (default (printf "%s-selenium-node-config" .Release.Name) .Values.nodeConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Server ConfigMap fullname +*/}} +{{- define "seleniumGrid.server.configmap.fullname" -}} +{{- tpl (default (printf "%s-selenium-server-config" .Release.Name) .Values.serverConfigMap.nameOverride) $ | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/selenium-grid/templates/chrome-node-hpa.yaml b/charts/selenium-grid/templates/chrome-node-hpa.yaml index 107e87b8b..36d6c3f43 100644 --- a/charts/selenium-grid/templates/chrome-node-hpa.yaml +++ b/charts/selenium-grid/templates/chrome-node-hpa.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: - name: selenium-grid-chrome-scaledobject + name: {{ template "seleniumGrid.chromeNode.fullname" . }} namespace: {{ .Release.Namespace }} annotations: helm.sh/resource-policy: delete diff --git a/charts/selenium-grid/templates/distributor-deployment.yaml b/charts/selenium-grid/templates/distributor-deployment.yaml index 03ec931e3..1bc310ea7 100644 --- a/charts/selenium-grid/templates/distributor-deployment.yaml +++ b/charts/selenium-grid/templates/distributor-deployment.yaml @@ -50,13 +50,13 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.busConfigMap.name $ }} + name: {{ template "seleniumGrid.eventBus.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ include "seleniumGrid.common.secrets.fullname" $ | quote }} {{- with .Values.components.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/edge-node-hpa.yaml b/charts/selenium-grid/templates/edge-node-hpa.yaml index 32bd3968e..604b89156 100644 --- a/charts/selenium-grid/templates/edge-node-hpa.yaml +++ b/charts/selenium-grid/templates/edge-node-hpa.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: - name: selenium-grid-edge-scaledobject + name: {{ template "seleniumGrid.edgeNode.fullname" . }} namespace: {{ .Release.Namespace }} annotations: helm.sh/resource-policy: delete diff --git a/charts/selenium-grid/templates/event-bus-configmap.yaml b/charts/selenium-grid/templates/event-bus-configmap.yaml index 0515aff22..7bbfd952d 100644 --- a/charts/selenium-grid/templates/event-bus-configmap.yaml +++ b/charts/selenium-grid/templates/event-bus-configmap.yaml @@ -4,7 +4,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ tpl .Values.busConfigMap.name $ }} + name: {{ template "seleniumGrid.eventBus.configmap.fullname" . }} namespace: {{ .Release.Namespace }} {{- with .Values.busConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/templates/event-bus-deployment.yaml b/charts/selenium-grid/templates/event-bus-deployment.yaml index 447931019..28efc3f29 100644 --- a/charts/selenium-grid/templates/event-bus-deployment.yaml +++ b/charts/selenium-grid/templates/event-bus-deployment.yaml @@ -49,11 +49,11 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ template "seleniumGrid.common.secrets.fullname" . }} {{- with .Values.components.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/firefox-node-hpa.yaml b/charts/selenium-grid/templates/firefox-node-hpa.yaml index e331a3475..490e16949 100644 --- a/charts/selenium-grid/templates/firefox-node-hpa.yaml +++ b/charts/selenium-grid/templates/firefox-node-hpa.yaml @@ -2,7 +2,7 @@ apiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: - name: selenium-grid-firefox-scaledobject + name: {{ template "seleniumGrid.firefoxNode.fullname" . }} namespace: {{ .Release.Namespace }} annotations: helm.sh/resource-policy: delete diff --git a/charts/selenium-grid/templates/hub-deployment.yaml b/charts/selenium-grid/templates/hub-deployment.yaml index 7e5b57b50..b8097756a 100644 --- a/charts/selenium-grid/templates/hub-deployment.yaml +++ b/charts/selenium-grid/templates/hub-deployment.yaml @@ -108,11 +108,11 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ template "seleniumGrid.common.secrets.fullname" . }} {{- with .Values.hub.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/logging-configmap.yaml b/charts/selenium-grid/templates/logging-configmap.yaml index a8c8de1f2..d8b5ab978 100644 --- a/charts/selenium-grid/templates/logging-configmap.yaml +++ b/charts/selenium-grid/templates/logging-configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} namespace: {{ .Release.Namespace }} {{- with .Values.loggingConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/templates/node-configmap.yaml b/charts/selenium-grid/templates/node-configmap.yaml index bdd72461a..3bddee26f 100644 --- a/charts/selenium-grid/templates/node-configmap.yaml +++ b/charts/selenium-grid/templates/node-configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ tpl .Values.nodeConfigMap.name $ }} + name: {{ template "seleniumGrid.node.configmap.fullname" $ }} namespace: {{ .Release.Namespace }} {{- with .Values.nodeConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/templates/recorder-configmap.yaml b/charts/selenium-grid/templates/recorder-configmap.yaml index 41611cdbd..9a6cf3b8f 100644 --- a/charts/selenium-grid/templates/recorder-configmap.yaml +++ b/charts/selenium-grid/templates/recorder-configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "seleniumGrid.recorder.fullname" $ }} + name: {{ template "seleniumGrid.recorder.configmap.fullname" $ }} namespace: {{ .Release.Namespace }} {{- with .Values.recorderConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/templates/router-deployment.yaml b/charts/selenium-grid/templates/router-deployment.yaml index 58ec11146..fa5d2d50a 100644 --- a/charts/selenium-grid/templates/router-deployment.yaml +++ b/charts/selenium-grid/templates/router-deployment.yaml @@ -62,11 +62,11 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ template "seleniumGrid.common.secrets.fullname" . }} {{- with .Values.components.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/secrets.yaml b/charts/selenium-grid/templates/secrets.yaml index 5d76c6930..87c57d8ff 100644 --- a/charts/selenium-grid/templates/secrets.yaml +++ b/charts/selenium-grid/templates/secrets.yaml @@ -5,7 +5,7 @@ metadata: {{- with .Values.secrets.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} - name: {{ include "seleniumGrid.common.secrets" . }} + name: {{ include "seleniumGrid.common.secrets.fullname" . }} labels: {{- include "seleniumGrid.commonLabels" . | nindent 4 }} {{- with .Values.customLabels }} diff --git a/charts/selenium-grid/templates/server-configmap.yaml b/charts/selenium-grid/templates/server-configmap.yaml index 33b573aa5..fbf161195 100644 --- a/charts/selenium-grid/templates/server-configmap.yaml +++ b/charts/selenium-grid/templates/server-configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} namespace: {{ .Release.Namespace }} {{- with .Values.busConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/templates/session-map-deployment.yaml b/charts/selenium-grid/templates/session-map-deployment.yaml index 2ce59e4d4..bfc788d7f 100644 --- a/charts/selenium-grid/templates/session-map-deployment.yaml +++ b/charts/selenium-grid/templates/session-map-deployment.yaml @@ -42,13 +42,13 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ template "seleniumGrid.common.secrets.fullname" . }} - configMapRef: - name: {{ tpl .Values.busConfigMap.name $ }} + name: {{ template "seleniumGrid.eventBus.configmap.fullname" . }} {{- with .Values.components.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/session-queuer-deployment.yaml b/charts/selenium-grid/templates/session-queuer-deployment.yaml index e0d74c054..3298f4182 100644 --- a/charts/selenium-grid/templates/session-queuer-deployment.yaml +++ b/charts/selenium-grid/templates/session-queuer-deployment.yaml @@ -42,11 +42,11 @@ spec: {{- end }} envFrom: - configMapRef: - name: {{ tpl .Values.loggingConfigMap.name $ }} + name: {{ template "seleniumGrid.logging.configmap.fullname" . }} - configMapRef: - name: {{ tpl .Values.serverConfigMap.name $ }} + name: {{ template "seleniumGrid.server.configmap.fullname" . }} - secretRef: - name: {{ include "seleniumGrid.common.secrets" $ | quote }} + name: {{ template "seleniumGrid.common.secrets.fullname" . }} {{- with .Values.components.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/selenium-grid/templates/uploader-configmap.yaml b/charts/selenium-grid/templates/uploader-configmap.yaml index 5f623c58c..22e5a8ba3 100644 --- a/charts/selenium-grid/templates/uploader-configmap.yaml +++ b/charts/selenium-grid/templates/uploader-configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "seleniumGrid.uploader.fullname" $ }} + name: {{ template "seleniumGrid.uploader.configmap.fullname" $ }} namespace: {{ .Release.Namespace }} {{- with .Values.uploaderConfigMap.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index 9ddefb348..c982713fd 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -57,7 +57,7 @@ isolateComponents: false # Service Account for all components serviceAccount: create: true - name: "" + # nameOverride: annotations: {} # eks.amazonaws.com/role-arn: "arn:aws:iam::12345678:role/video-bucket-permissions" @@ -92,13 +92,13 @@ ingress: # ConfigMap that contains SE_EVENT_BUS_HOST, SE_EVENT_BUS_PUBLISH_PORT and SE_EVENT_BUS_SUBSCRIBE_PORT variables busConfigMap: # Name of the configmap - name: "{{ .Release.Name }}-selenium-event-bus-config" + # nameOverride: # Custom annotations for configmap annotations: {} # ConfigMap that contains common environment variables for browser nodes nodeConfigMap: - name: "{{ .Release.Name }}-selenium-node-config" + # nameOverride: # Default mode for ConfigMap is mounted as file defaultMode: 0755 # File name of preStop script in ConfigMap @@ -106,12 +106,12 @@ nodeConfigMap: extraScripts: nodePreStop.sh: # Name of volume mount is used to mount scripts in the ConfigMap - scriptVolumeMountName: node-helper-scripts + scriptVolumeMountName: # Custom annotations for configmap annotations: {} recorderConfigMap: - name: "{{ .Release.Name }}-selenium-recorder-config" + # nameOverride: # Default mode for ConfigMap is mounted as file defaultMode: 0755 # Directory where the extra scripts are mounted to @@ -121,13 +121,13 @@ recorderConfigMap: # video.sh: # video_graphQLQuery.sh: # Name of volume mount is used to mount scripts in the ConfigMap - scriptVolumeMountName: recorder-helper-scripts + scriptVolumeMountName: videoVolumeMountName: videos # Custom annotations for configmap annotations: {} uploaderConfigMap: - name: "{{ .Release.Name }}-selenium-uploader-config" + # nameOverride: # Default mode for ConfigMap is mounted as file defaultMode: 0755 # Directory where the extra scripts are mounted to @@ -139,22 +139,22 @@ uploaderConfigMap: secretFiles: upload.conf: "[sample]" # Name of volume mount is used to mount scripts in the ConfigMap - scriptVolumeMountName: uploader-helper-scripts + scriptVolumeMountName: # Name of Secret is used to store the `secretFiles` - secretVolumeMountName: '{{ include "seleniumGrid.common.secrets" $ }}' + secretVolumeMountName: # Custom annotations for configmap annotations: {} # ConfigMap that contains common environment variables for Logging (https://www.selenium.dev/documentation/grid/configuration/cli_options/#logging) loggingConfigMap: - name: "{{ .Release.Name }}-selenium-logging-config" + # nameOverride: # Custom annotations for configmap annotations: {} # ConfigMap that contains common environment variables for Server (https://www.selenium.dev/documentation/grid/configuration/cli_options/#server) serverConfigMap: - name: "{{ .Release.Name }}-selenium-server-config" + # nameOverride: certVolumeMountPath: /etc/ssl/certs/selenium certificateFile: selenium.pem privateKeyFile: selenium.pkcs8 @@ -164,10 +164,10 @@ serverConfigMap: # Custom annotations for configmap annotations: {} -# Secrets for all components. Components environment variables contain sensitive data should be stored in secrets. +# Secrets for all components. Component environment variables contain sensitive data should be stored in secrets. secrets: create: true - name: selenium-secrets + # nameOverride: env: SE_VNC_PASSWORD: "secret" annotations: {} @@ -529,9 +529,9 @@ autoscaling: scaledObjectOptions: scaleTargetRef: kind: Deployment - # Define terminationGracePeriodSeconds for scalingType "deployment". Period for `deregisterLifecycle` to gracefully shut down the node before force killing it + # Define terminationGracePeriodSeconds for scalingType "deployment". Period for `deregisterLifecycle` to gracefully shut down the node before force terminating it terminationGracePeriodSeconds: 3600 - # Define preStop command to shuts down the node gracefully when scalingType is set to "deployment" + # Define preStop command to shut down the node gracefully when scalingType is set to "deployment" deregisterLifecycle: # preStop: # exec: @@ -544,7 +544,7 @@ chromeNode: # NOTE: Only used when autoscaling.enabled is false # Enable creation of Deployment - # true (default) - if you want long living pods + # true (default) - if you want long-living pods # false - for provisioning your own custom type such as Jobs deploymentEnabled: true @@ -661,7 +661,7 @@ chromeNode: # Time to wait for pod termination terminationGracePeriodSeconds: 30 - # Define preStop command to shuts down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle + # Define preStop command to shut down the chrome node gracefully. This overwrites autoscaling.deregisterLifecycle deregisterLifecycle: # Define postStart and preStop events. This overwrites the defined preStop in deregisterLifecycle if any lifecycle: {} @@ -681,17 +681,17 @@ chromeNode: # scaledJobOptions: # scaledObjectOptions: hpa: - url: '{{ include "seleniumGrid.graphqlURL" . }}' + url: '{{ template "seleniumGrid.graphqlURL" . }}' browserName: chrome sessionBrowserName: 'chrome' # browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid. - unsafeSsl: '{{ include "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional + unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional # It is used to add initContainers in the same pod of the browser node. # It should be set using the --set-json option initContainers: [] - # It is used to add a sidecars proxy in the same pod of the browser node. + # 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 sidecars: [] @@ -841,16 +841,16 @@ firefoxNode: # scaledJobOptions: # scaledObjectOptions: hpa: - url: '{{ include "seleniumGrid.graphqlURL" . }}' + url: '{{ template "seleniumGrid.graphqlURL" . }}' browserName: firefox sessionBrowserName: 'firefox' - unsafeSsl: '{{ include "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional + unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional # It is used to add initContainers in the same pod of the browser node. # It should be set using the --set-json option initContainers: [] - # It is used to add a sidecars proxy in the same pod of the browser node. + # 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 sidecars: [] @@ -999,16 +999,16 @@ edgeNode: # scaledJobOptions: # scaledObjectOptions: hpa: - url: '{{ include "seleniumGrid.graphqlURL" . }}' + url: '{{ template "seleniumGrid.graphqlURL" . }}' browserName: MicrosoftEdge sessionBrowserName: 'msedge' - unsafeSsl: '{{ include "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional + unsafeSsl: '{{ template "seleniumGrid.graphqlURL.unsafeSsl" . }}' # Optional # It is used to add initContainers in the same pod of the browser node. # It should be set using the --set-json option initContainers: [] - # It is used to add a sidecars proxy in the same pod of the browser node. + # 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 sidecars: [] @@ -1088,10 +1088,6 @@ videoRecorder: # Define lifecycle events for video recorder lifecycle: {} - volume: - # name: - # folder: video - # scripts: video-scripts # Custom video recorder back-end scripts (video.sh, video_ready.py, etc.) further by ConfigMap. # NOTE: For the mount point with the name "video", or "video-scripts", it will override the default. For other names, it will be appended. extraVolumeMounts: [] diff --git a/tests/SeleniumTests/__init__.py b/tests/SeleniumTests/__init__.py index c469d68ba..a1465d61e 100644 --- a/tests/SeleniumTests/__init__.py +++ b/tests/SeleniumTests/__init__.py @@ -164,7 +164,9 @@ def run(self, test_classes): for test in failed_tests: try: print(f"Rerunning test: {str(test)}") - test.run() + rerun_result = test.run() + if not rerun_result.wasSuccessful(): + raise Exception except Exception as e: print(traceback.format_exc()) print(f"Test {str(test)} failed again with exception: {str(e)}") diff --git a/tests/charts/ci/base-recorder-values.yaml b/tests/charts/ci/base-recorder-values.yaml index 32efa50ed..2b7e7447c 100644 --- a/tests/charts/ci/base-recorder-values.yaml +++ b/tests/charts/ci/base-recorder-values.yaml @@ -33,3 +33,8 @@ videoRecorder: RCLONE_CONFIG_GS_ACCESS_KEY_ID: "${GS_ACCESS_KEY_ID}" RCLONE_CONFIG_GS_SECRET_ACCESS_KEY: "${GS_SECRET_ACCESS_KEY}" RCLONE_CONFIG_GS_ENDPOINT: "https://storage.googleapis.com" + +ingress-nginx: + controller: + extraArgs: + default-ssl-certificate: '$(POD_NAMESPACE)/${RELEASE_NAME}-selenium-tls-secret' diff --git a/tests/charts/ci/base-tls-values.yaml b/tests/charts/ci/base-tls-values.yaml index 0f7439251..5cdd2427e 100644 --- a/tests/charts/ci/base-tls-values.yaml +++ b/tests/charts/ci/base-tls-values.yaml @@ -4,8 +4,3 @@ tls: registrationSecret: enabled: true value: "HappyTestOps" - -ingress-nginx: - controller: - extraArgs: - default-ssl-certificate: '$(POD_NAMESPACE)/selenium-tls-secret' diff --git a/tests/charts/make/chart_test.sh b/tests/charts/make/chart_test.sh index b6cc075e9..e6686ca31 100755 --- a/tests/charts/make/chart_test.sh +++ b/tests/charts/make/chart_test.sh @@ -47,14 +47,16 @@ on_failure() { # Trap ERR signal and call on_failure function trap 'on_failure' ERR -RECORDER_VALUES_FILE=${TEST_VALUES_PATH}/base-recorder-values.yaml if [ -f .env ] then - export $(cat .env | xargs) - echo "Render values files with .env" - envsubst < ${RECORDER_VALUES_FILE} > ./tests/tests/base-recorder-values.yaml - RECORDER_VALUES_FILE=./tests/tests/base-recorder-values.yaml + export "$(cat .env | xargs)" +else + export UPLOAD_ENABLED=false fi +export RELEASE_NAME=${RELEASE_NAME} +RECORDER_VALUES_FILE=${TEST_VALUES_PATH}/base-recorder-values.yaml +envsubst < ${RECORDER_VALUES_FILE} > ./tests/tests/base-recorder-values.yaml +RECORDER_VALUES_FILE=./tests/tests/base-recorder-values.yaml HELM_COMMAND_SET_IMAGES=" \ --set global.seleniumGrid.imageRegistry=${NAMESPACE} \ diff --git a/tests/charts/templates/render/dummy.yaml b/tests/charts/templates/render/dummy.yaml index e41cac575..acf584ec9 100644 --- a/tests/charts/templates/render/dummy.yaml +++ b/tests/charts/templates/render/dummy.yaml @@ -14,6 +14,10 @@ global: - selenium topologyKey: "kubernetes.io/hostname" +autoscaling: + enableWithExistingKEDA: true + scalingType: deployment + basicAuth: username: sysadmin password: strongPassword diff --git a/tests/charts/templates/test.py b/tests/charts/templates/test.py index 18cc05e8e..5ac422594 100644 --- a/tests/charts/templates/test.py +++ b/tests/charts/templates/test.py @@ -128,6 +128,13 @@ def test_node_port_set_when_service_type_is_node_port(self): count += 1 self.assertEqual(count, len(single_node_port.keys()), "Number of services with NodePort is not correct") + def test_all_metadata_name_is_prefixed_with_release_name(self): + logger.info(f"Assert all metadata name is prefixed with RELEASE NAME") + for doc in LIST_OF_DOCUMENTS: + logger.info(f"Assert metadata name: {doc['metadata']['name']}") + self.assertTrue(doc['metadata']['name'].startswith(RELEASE_NAME), + f"Metadata name {doc['metadata']['name']} is not prefixed with RELEASE NAME: {RELEASE_NAME}") + if __name__ == '__main__': failed = False try: