From e27f6edbfa0b31464bdeae3a772dc01c4725b8b5 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Thu, 19 Sep 2024 11:45:33 +0000 Subject: [PATCH] chart(update): replace another mininal kubectl container for patch job Signed-off-by: Viet Nguyen Duc --- charts/selenium-grid/CONFIGURATION.md | 4 +++- .../templates/patch-keda/patch-keda-objects-job.yaml | 11 +++++++++-- charts/selenium-grid/values.yaml | 12 +++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/charts/selenium-grid/CONFIGURATION.md b/charts/selenium-grid/CONFIGURATION.md index 6c84818c81..eddfa2e153 100644 --- a/charts/selenium-grid/CONFIGURATION.md +++ b/charts/selenium-grid/CONFIGURATION.md @@ -32,7 +32,7 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | global.seleniumGrid.imageTag | string | `"4.24.0-20240907"` | Image tag for all selenium components | | global.seleniumGrid.nodesImageTag | string | `"4.24.0-20240907"` | Image tag for browser's nodes | | global.seleniumGrid.videoImageTag | string | `"ffmpeg-7.0.2-20240907"` | Image tag for browser's video recorder | -| global.seleniumGrid.kubectlImage | string | `"bitnami/kubectl:latest"` | kubectl image is used to execute kubectl commands in utility jobs | +| global.seleniumGrid.kubectlImage | string | `"jitesoft/kubectl:latest"` | kubectl image is used to execute kubectl commands in utility jobs | | global.seleniumGrid.imagePullSecret | string | `""` | Pull secret for all components, can be overridden individually | | global.seleniumGrid.logLevel | string | `"INFO"` | Log level for all components. Possible values describe here: https://www.selenium.dev/documentation/grid/configuration/cli_options/#logging | | global.seleniumGrid.defaultNodeStartupProbe | string | `"exec"` | Set default startup probe method for all nodes (supplied values: httpGet, exec). If not set, the default is httpGet | @@ -305,6 +305,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes | 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 | | autoscaling.patchObjectFinalizers.activeDeadlineSeconds | int | `120` | Deadline (in seconds) for patch job to complete | | 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 | +| autoscaling.patchObjectFinalizers.imagePullSecret | string | `""` | Custom pull secret for container in patch job | +| autoscaling.patchObjectFinalizers.resources | object | `{"limits":{"cpu":"50m","memory":"50Mi"},"requests":{"cpu":"10m","memory":"10Mi"}}` | Define resources for container in patch job | | autoscaling.scaledOptions | object | `{"maxReplicaCount":8,"minReplicaCount":0,"pollingInterval":10}` | Options for KEDA scaled resources (keep only common options used for both ScaledJob and ScaledObject) | | autoscaling.scaledOptions.minReplicaCount | int | `0` | Minimum number of replicas | | autoscaling.scaledOptions.maxReplicaCount | int | `8` | Maximum number of replicas | diff --git a/charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml b/charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml index 794f7122bd..408319ea49 100644 --- a/charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml +++ b/charts/selenium-grid/templates/patch-keda/patch-keda-objects-job.yaml @@ -30,12 +30,19 @@ spec: containers: - name: {{ template "seleniumGrid.keda.patchObjectsJob.fullname" $ }} image: {{ $.Values.global.seleniumGrid.kubectlImage }} - command: ["/bin/bash", "-c"] + command: ["/bin/sh", "-c"] args: - | echo "Cleaning up ScaledObjects, ScaledJobs and HPAs for {{ .Release.Name }} when upgrading or disabling autoscaling." - kubectl get ScaledObjects,ScaledJobs -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} -o=json | jq '.metadata.finalizers = null' | kubectl apply -f - || true ; + kubectl patch ScaledObjects,ScaledJobs -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} -p '{"metadata":{"finalizers":null}}' || true ; kubectl delete ScaledObjects,ScaledJobs -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait || true ; kubectl delete hpa -n {{ .Release.Namespace }} -l component.autoscaling={{ .Release.Name }} --wait || true ; + {{- with $.Values.autoscaling.patchObjectFinalizers.resources }} + resources: {{ toYaml . | nindent 12 }} + {{- end }} + {{- if or $.Values.global.seleniumGrid.imagePullSecret $.Values.autoscaling.patchObjectFinalizers.imagePullSecret }} + imagePullSecrets: + - name: {{ default $.Values.global.seleniumGrid.imagePullSecret $.Values.autoscaling.patchObjectFinalizers.imagePullSecret }} + {{- end }} restartPolicy: Never {{- end }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index dbcfcd8917..9e9ae5fab1 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -13,7 +13,7 @@ global: # -- Image tag for browser's video recorder videoImageTag: ffmpeg-7.0.2-20240907 # -- kubectl image is used to execute kubectl commands in utility jobs - kubectlImage: bitnami/kubectl:latest + kubectlImage: jitesoft/kubectl:latest # -- Pull secret for all components, can be overridden individually imagePullSecret: "" # -- Log level for all components. Possible values describe here: https://www.selenium.dev/documentation/grid/configuration/cli_options/#logging @@ -796,6 +796,16 @@ autoscaling: "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" + # -- Custom pull secret for container in patch job + imagePullSecret: "" + # -- Define resources for container in patch job + resources: + requests: + cpu: 10m + memory: 10Mi + limits: + cpu: 50m + memory: 50Mi # -- Options for KEDA scaled resources (keep only common options used for both ScaledJob and ScaledObject) scaledOptions: # -- Minimum number of replicas