Skip to content

Commit 12868dd

Browse files
committed
chart: add config key to disable resource creation
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent a3b4b62 commit 12868dd

18 files changed

+103
-37
lines changed

Diff for: Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ chart_test_autoscaling_disabled:
913913
chart_test_autoscaling_deployment_https:
914914
PLATFORMS=$(PLATFORMS) CHART_FULL_DISTRIBUTED_MODE=true CHART_ENABLE_BASIC_AUTH=true \
915915
SECURE_INGRESS_ONLY_DEFAULT=true INGRESS_DISABLE_USE_HTTP2=true SELENIUM_GRID_PROTOCOL=https CHART_ENABLE_INGRESS_HOSTNAME=true SELENIUM_GRID_PORT=443 \
916-
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 MAX_SESSIONS_FIREFOX=3 MAX_SESSIONS_EDGE=2 MAX_SESSIONS_CHROME=1 \
916+
SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 MAX_SESSIONS_FIREFOX=3 MAX_SESSIONS_EDGE=2 MAX_SESSIONS_CHROME=1 TEST_NAME_OVERRIDE=true \
917917
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) \
918918
TEMPLATE_OUTPUT_FILENAME="k8s_fullDistributed_basicAuth_secureIngress_defaultCerts_ingressHostName_disableHttp2_autoScaling_scaledObject_subPath.yaml" \
919919
./tests/charts/make/chart_test.sh DeploymentAutoscaling
@@ -929,7 +929,7 @@ chart_test_autoscaling_deployment:
929929
chart_test_autoscaling_job_https:
930930
PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_BASIC_AUTH=true \
931931
SECURE_CONNECTION_SERVER=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 SUB_PATH=/ \
932-
MAX_SESSIONS_FIREFOX=1 MAX_SESSIONS_EDGE=2 MAX_SESSIONS_CHROME=3 \
932+
MAX_SESSIONS_FIREFOX=1 MAX_SESSIONS_EDGE=2 MAX_SESSIONS_CHROME=3 TEST_NAME_OVERRIDE=true \
933933
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) EXTERNAL_UPLOADER_CONFIG=true \
934934
TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_basicAuth_secureServer_autoScaling_scaledJob_existingKEDA.yaml" \
935935
./tests/charts/make/chart_test.sh JobAutoscaling
@@ -955,6 +955,11 @@ chart_test_language_bindings:
955955
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) \
956956
./tests/charts/make/chart_test.sh DeploymentAutoscaling
957957

958+
chart_test_delete:
959+
helm del test -n selenium || true
960+
helm del selenium -n selenium || true
961+
helm del keda -n keda || true
962+
958963
.PHONY: \
959964
all \
960965
base \

Diff for: charts/selenium-grid/CONFIGURATION.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
4747
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
4848
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |
4949
| global.seleniumGrid.nodeMaxSessions | int | `1` | Specify number of max sessions per node. Can be overridden by individual component (this is also set to scaler trigger parameter `nodeMaxSessions` if `autoscaling` is enabled) |
50+
| tls.create | bool | `true` | Create a Secret resource for TLS certificate and key. If using an external secret set to false and provide its name in `nameOverride` below |
5051
| tls.nameOverride | string | `nil` | Name of external secret containing the TLS certificate and key |
5152
| tls.enabled | bool | `false` | Enable or disable TLS for the server components (and ingress proxy) |
5253
| tls.ingress.enabled | bool | `false` | Enable or disable TLS for the ingress proxy only |
@@ -67,18 +68,23 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
6768
| tls.disableHostnameVerification | bool | `true` | Disable verification the hostname included in the server's TLS/SSL certificates matches the hostnames provided |
6869
| registrationSecret.enabled | bool | `false` | Enable feature node registration secret to make sure that the node is one you control and not a rouge node |
6970
| registrationSecret.value | string | `"HappyTesting"` | The secret value to be used for node registration |
70-
| basicAuth.nameOverride | string | `""` | External secret containing the basic auth username and password for reference |
71+
| basicAuth.create | bool | `true` | Create a secret resource for basic auth. If using an external secret, set to false and provide its name in `nameOverride` below |
72+
| basicAuth.nameOverride | string | `nil` | External secret containing the basic auth username and password for reference |
7173
| basicAuth.enabled | bool | `false` | Enable or disable basic auth for the Hub/Router |
7274
| basicAuth.username | string | `"admin"` | Username for basic auth |
7375
| basicAuth.password | string | `"admin"` | Password for basic auth |
7476
| basicAuth.embeddedUrl | bool | `false` | Embed the basic auth "username:password@" in few URLs e.g. SE_NODE_GRID_URL |
7577
| basicAuth.annotations | object | `{}` | Annotations for basic auth secret resource |
7678
| isolateComponents | bool | `false` | Deploy Router, Distributor, EventBus, SessionMap and Nodes separately |
77-
| serviceAccount.create | bool | `true` | Create a service account for all components |
79+
| serviceAccount.create | bool | `true` | Create a service account for all components. If using an external service account, set to false and provide its name in `nameOverride` below |
7880
| serviceAccount.nameOverride | string | `nil` | Override to use an external service account |
7981
| serviceAccount.annotations | object | `{}` | Annotations for the service account |
80-
| rbacRole | object | `{"annotations":{},"nameOverride":null,"rules":[{"apiGroups":["keda.sh"],"resources":["scaledjobs"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["scaledobjects"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["autoscaling"],"resources":["horizontalpodautoscalers"],"verbs":["get","list","patch","update","delete"]}]}` | RBAC settings for patching finalizers KEDA scaled resources |
81-
| rbacRoleBinding | object | `{"annotations":{},"nameOverride":null,"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role"}}` | RBAC role binding settings for patching finalizers KEDA scaled resources |
82+
| rbacRole | object | `{"annotations":{},"create":true,"nameOverride":null,"rules":[{"apiGroups":["keda.sh"],"resources":["scaledjobs"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["keda.sh"],"resources":["scaledobjects"],"verbs":["get","list","patch","update","delete"]},{"apiGroups":["autoscaling"],"resources":["horizontalpodautoscalers"],"verbs":["get","list","patch","update","delete"]}]}` | RBAC settings for patching finalizers KEDA scaled resources |
83+
| rbacRole.create | bool | `true` | Enable to create RBAC role to access few KEDA resources. If using an external role, set to false and provide its name in `nameOverride` below |
84+
| rbacRole.nameOverride | string | `nil` | Override resource name or provide an external role name |
85+
| rbacRoleBinding | object | `{"annotations":{},"create":true,"nameOverride":null,"roleRef":{"apiGroup":"rbac.authorization.k8s.io","kind":"Role"},"subjects":[{"kind":"ServiceAccount"}]}` | RBAC role binding settings for patching finalizers KEDA scaled resources |
86+
| rbacRoleBinding.create | bool | `true` | Enable to create RBAC role binding to a service account. If using an external role binding, set to false and provide its name in `nameOverride` below |
87+
| rbacRoleBinding.nameOverride | string | `nil` | Override resource name or provide an external role binding name |
8288
| ingress.enabled | bool | `true` | Enable to create ingress resource |
8389
| ingress.enableWithController | bool | `false` | Enable ingress resource with automatically installing Ingress NGINX Controller |
8490
| ingress.className | string | `""` | Name of ingress class to select which controller will implement ingress resource |
@@ -154,7 +160,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
154160
| serverConfigMap.nameOverride | string | `nil` | Override the name of the server configMap |
155161
| serverConfigMap.env | object | `{"SE_JAVA_OPTS":"-Djdk.httpclient.keepalive.timeout=300 -Djdk.httpclient.maxstreams=10000 -XX:+UseZGC","SE_SUPERVISORD_LOG_LEVEL":"info"}` | Extra common environment variables for Server (https://www.selenium.dev/documentation/grid/configuration/cli_options/#server) to server configMap |
156162
| serverConfigMap.annotations | object | `{}` | Custom annotations for configmap |
157-
| secrets.create | bool | `true` | Create the default secret for all components |
163+
| secrets.create | bool | `true` | Create the default secret for all components. If using an external secret, set to false and provide its name in `nameOverride` below |
158164
| secrets.nameOverride | string | `nil` | Override to use an external secret |
159165
| secrets.env | object | `{"SE_VNC_PASSWORD":"secret"}` | Extra environment variables set to the secret |
160166
| secrets.annotations | object | `{}` | Custom annotations for secret |
@@ -304,12 +310,13 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
304310
| autoscaling.enabled | bool | `false` | Enable autoscaling. Implies installing KEDA |
305311
| autoscaling.enableWithExistingKEDA | bool | `false` | Enable autoscaling without automatically installing KEDA |
306312
| autoscaling.scalingType | string | `"job"` | Which type of KEDA scaling to use: job or deployment |
307-
| autoscaling.authenticationRef | object | `{"name":""}` | Specify an external KEDA TriggerAuthentication resource is used for scaler triggers config. Apply for all browser nodes |
313+
| autoscaling.authenticationRef | object | `{"annotations":{"helm.sh/hook":"post-install,post-upgrade,post-rollback","helm.sh/hook-weight":"-2"},"name":""}` | Specify an external KEDA TriggerAuthentication resource is used for scaler triggers config. Apply for all browser nodes |
308314
| autoscaling.annotations | object | `{"helm.sh/hook":"post-install,post-upgrade,post-rollback","helm.sh/hook-weight":"1"}` | Annotations for KEDA resources: ScaledObject and ScaledJob |
309315
| autoscaling.patchObjectFinalizers.nameOverride | string | `nil` | Override the name of the patch job |
310316
| autoscaling.patchObjectFinalizers.enabled | bool | `true` | Enable patching finalizers for KEDA scaled resources. Workaround for Hook post-upgrade selenium-grid/templates/x-node-hpa.yaml failed: object is being deleted: scaledobjects.keda.sh "x" already exists |
311317
| autoscaling.patchObjectFinalizers.activeDeadlineSeconds | int | `120` | Deadline (in seconds) for patch job to complete |
312318
| autoscaling.patchObjectFinalizers.annotations | object | `{"helm.sh/hook":"post-install,post-upgrade,post-rollback,pre-delete","helm.sh/hook-delete-policy":"hook-succeeded,before-hook-creation","helm.sh/hook-weight":"-1"}` | Annotations for patch job |
319+
| autoscaling.patchObjectFinalizers.serviceAccount | string | `""` | Define an external service account name contains permissions to patch KEDA scaled resources |
313320
| autoscaling.patchObjectFinalizers.imagePullSecret | string | `""` | Custom pull secret for container in patch job |
314321
| autoscaling.patchObjectFinalizers.resources | object | `{"limits":{"cpu":"50m","memory":"50Mi"},"requests":{"cpu":"10m","memory":"10Mi"}}` | Define resources for container in patch job |
315322
| autoscaling.scaledOptions | object | `{"maxReplicaCount":8,"minReplicaCount":0,"pollingInterval":10}` | Options for KEDA scaled resources (keep only common options used for both ScaledJob and ScaledObject) |
@@ -498,7 +505,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
498505
| videoRecorder.lifecycle | object | `{}` | Define lifecycle events for video recorder |
499506
| videoRecorder.extraVolumeMounts | list | `[]` | 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. |
500507
| videoRecorder.extraVolumes | list | `[]` | Extra volumes for video recorder pod |
501-
| videoRecorder.s3 | object | `{"args":[],"command":[],"extraEnvironmentVariables":null,"imageName":"bitnami/aws-cli","imagePullPolicy":"IfNotPresent","imageRegistry":"public.ecr.aws","imageTag":"latest","securityContext":{"runAsUser":0}}` | Container spec for the uploader if above it is defined as "uploader.name: s3" |
508+
| videoRecorder.s3 | object | `{"args":[],"command":[],"extraEnvironmentVariables":null,"imageName":"aws-cli","imagePullPolicy":"IfNotPresent","imageRegistry":"bitnami","imageTag":"latest","securityContext":{"runAsUser":0}}` | Container spec for the uploader if above it is defined as "uploader.name: s3" |
502509
| customLabels | object | `{}` | Custom labels for k8s resources |
503510
| keda.image | object | `{"keda":{"registry":"selenium","repository":"keda","tag":"2.15.1-selenium-grid-20240907"},"metricsApiServer":{"registry":"selenium","repository":"keda-metrics-apiserver","tag":"2.15.1-selenium-grid-20240907"},"webhooks":{"registry":"selenium","repository":"keda-admission-webhooks","tag":"2.15.1-selenium-grid-20240907"}}` | Specify image for KEDA components |
504511
| keda.additionalAnnotations | string | `nil` | Annotations for KEDA resources |

Diff for: charts/selenium-grid/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ There are multiple ways to insert your certificate, private key, truststore to t
672672
--from-file=server.pass=/path/to/your/server.pass
673673
# Deploy chart with your external TLS Secret
674674
helm upgrade -i $RELEASENAME -n $NAMESPACE docker-selenium/selenium-grid \
675-
--set tls.enabled=true --set tls.nameOverride=my-external-tls-secret
675+
--set tls.enabled=true --set tls.create=false --set tls.nameOverride=my-external-tls-secret
676676
```
677677

678678
In case your external secret contains key file names are different with default, you can instruct server to use them via following values:
@@ -717,6 +717,7 @@ helm upgrade -i $RELEASENAME -n $NAMESPACE docker-selenium/selenium-grid \
717717
--set isolateComponents=true \
718718
--set components.router.serviceType=NodePort \
719719
--set tls.enabled=true \
720+
--set tls.create=false \
720721
--set tls.nameOverride=my-external-tls-secret
721722
```
722723

@@ -770,6 +771,7 @@ helm upgrade -i $RELEASENAME -n $NAMESPACE docker-selenium/selenium-grid \
770771
--set ingress.enabled=true \
771772
--set ingress.hostname="selenium-grid.prod.domain.com" \
772773
--set tls.ingress.enabled=true \
774+
--set tls.create=false \
773775
--set tls.nameOverride=my-external-tls-secret
774776
```
775777

@@ -795,6 +797,7 @@ For example (replace `$RELEASENAME` and `$NAMESPACE` with your values):
795797
helm upgrade -i $RELEASENAME -n $NAMESPACE docker-selenium/selenium-grid \
796798
--set global.K8S_PUBLIC_IP=$(hostname -i) \
797799
--set tls.ingress.enableWithController=true \
800+
--set tls.create=false \
798801
--set tls.nameOverride=my-external-tls-secret \
799802
--set ingress-nginx.controller.extraArgs.default-ssl-certificate=$NAMESPACE/my-external-tls-secret
800803
```

Diff for: charts/selenium-grid/templates/basic-auth-secret.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if (not $.Values.basicAuth.nameOverride) }}
1+
{{- if $.Values.basicAuth.create }}
22
apiVersion: v1
33
kind: Secret
44
metadata:

Diff for: charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ spec:
2525
name: {{ template "seleniumGrid.keda.patchObjectsJob.fullname" $ }}
2626
spec:
2727
activeDeadlineSeconds: {{ $.Values.autoscaling.patchObjectFinalizers.activeDeadlineSeconds }}
28-
serviceAccountName: {{ template "seleniumGrid.serviceAccount.fullname" $ }}
29-
serviceAccount: {{ template "seleniumGrid.serviceAccount.fullname" $ }}
28+
serviceAccountName: {{ default (include "seleniumGrid.serviceAccount.fullname" $) $.Values.autoscaling.patchObjectFinalizers.serviceAccount }}
29+
serviceAccount: {{ default (include "seleniumGrid.serviceAccount.fullname" $) $.Values.autoscaling.patchObjectFinalizers.serviceAccount }}
3030
containers:
31-
- name: {{ template "seleniumGrid.keda.patchObjectsJob.fullname" $ }}
31+
- name: kubectl
3232
image: {{ $.Values.global.seleniumGrid.kubectlImage }}
3333
command: ["/bin/sh", "-c"]
3434
args:

Diff for: charts/selenium-grid/templates/patch-keda/rbac-role.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") $.Values.autoscaling.patchObjectFinalizers.enabled }}
1+
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") $.Values.autoscaling.patchObjectFinalizers.enabled (not $.Values.autoscaling.patchObjectFinalizers.serviceAccount) }}
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: Role
44
metadata:
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") $.Values.autoscaling.patchObjectFinalizers.enabled }}
1+
{{- if and (eq (include "seleniumGrid.useKEDA" $) "true") $.Values.autoscaling.patchObjectFinalizers.enabled (not $.Values.autoscaling.patchObjectFinalizers.serviceAccount) }}
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: RoleBinding
44
metadata:
@@ -9,17 +9,18 @@ metadata:
99
{{- toYaml . | nindent 4 }}
1010
{{- end }}
1111
labels:
12-
deploymentName: {{ template "seleniumGrid.rbac.roleBinding.fullname" $ }}
12+
app: {{ template "seleniumGrid.rbac.roleBinding.fullname" $ }}
13+
app.kubernetes.io/name: {{ template "seleniumGrid.rbac.roleBinding.fullname" $ }}
1314
{{- include "seleniumGrid.commonLabels" $ | nindent 4 }}
1415
{{- with $.Values.customLabels }}
1516
{{- toYaml . | nindent 4 }}
1617
{{- end }}
1718
subjects:
1819
- kind: ServiceAccount
19-
name: {{ template "seleniumGrid.serviceAccount.fullname" $ }}
20+
name: {{ default (include "seleniumGrid.serviceAccount.fullname" $) $.Values.autoscaling.patchObjectFinalizers.serviceAccount }}
2021
{{ with $.Values.rbacRoleBinding.roleRef }}
2122
{{- $roleRef := merge (dict "name" (include "seleniumGrid.rbac.role.fullname" $)) . -}}
2223
roleRef:
23-
{{ $roleRef | toYaml | nindent 2 }}
24+
{{- $roleRef | toYaml | nindent 2 }}
2425
{{- end }}
2526
{{- end }}

Diff for: charts/selenium-grid/templates/serviceaccount.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.serviceAccount.create }}
1+
{{- if $.Values.serviceAccount.create }}
22
apiVersion: v1
33
kind: ServiceAccount
44
metadata:

Diff for: charts/selenium-grid/templates/tls-cert-secret.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if and (not $.Values.tls.nameOverride) (or (eq (include "seleniumGrid.ingress.secureConnection" $) "true") (eq (include "seleniumGrid.server.secureConnection" $) "true")) }}
1+
{{- if and $.Values.tls.create (or (eq (include "seleniumGrid.ingress.secureConnection" $) "true") (eq (include "seleniumGrid.server.secureConnection" $) "true")) }}
22
apiVersion: v1
33
kind: Secret
44
metadata:

Diff for: charts/selenium-grid/templates/trigger-auth.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
name: {{ template "seleniumGrid.autoscaling.authenticationRef.fullname" $ }}
66
namespace: {{ .Release.Namespace }}
77
annotations:
8-
{{- with $.Values.autoscaling.annotations }}
8+
{{- with $.Values.autoscaling.authenticationRef.annotations }}
99
{{- toYaml . | nindent 4 }}
1010
{{- end }}
1111
labels:

0 commit comments

Comments
 (0)