From fc21bef606ab44c7b940bd42ca9e538ec333616d Mon Sep 17 00:00:00 2001 From: marcusalb Date: Mon, 11 Sep 2023 14:47:21 +0200 Subject: [PATCH] feat: Add option to inject sidecars into Node Pods (#1938) * Add option to inject sidecars into Node Pods * Add example to add sidecar --- charts/selenium-grid/README.md | 8 ++++++++ charts/selenium-grid/templates/_helpers.tpl | 3 +++ charts/selenium-grid/values.yaml | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 8e67fb6d4..ed20f1785 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -61,6 +61,14 @@ Once you have a new chart version, you can update your selenium-grid running: helm upgrade selenium-grid docker-selenium/selenium-grid ``` +If needed, you can add sidecars for your browser nodes by running: + +```bash +helm upgrade selenium-grid docker-selenium/selenium-grid --set 'firefoxNode.enabled=true' --set-json 'firefoxNode.sidecars=[{"name":"my-sidecar","image":"my-sidecar:latest","imagePullPolicy":"IfNotPresent","ports":[{"containerPort":8080, "protocol":"TCP"}],"resources":{"limits":{"memory": "128Mi"},"requests":{"cpu": "100m"}}}]' +``` + +Note: the parameter used for --set-json is just an example, please refer to [Container Spec](https://www.devspace.sh/component-chart/docs/configuration/containers) for an overview of usable parameters. + ## Uninstalling Selenium Grid release To uninstall: diff --git a/charts/selenium-grid/templates/_helpers.tpl b/charts/selenium-grid/templates/_helpers.tpl index 1ce1611c0..694b7a5c9 100644 --- a/charts/selenium-grid/templates/_helpers.tpl +++ b/charts/selenium-grid/templates/_helpers.tpl @@ -165,6 +165,9 @@ template: {{- with .node.livenessProbe }} livenessProbe: {{- toYaml . | nindent 10 }} {{- end }} + {{- if .node.sidecars }} + {{- toYaml .node.sidecars | nindent 6 }} + {{- end }} {{- if or .Values.global.seleniumGrid.imagePullSecret .node.imagePullSecret }} imagePullSecrets: - name: {{ default .Values.global.seleniumGrid.imagePullSecret .node.imagePullSecret }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index 4bb3989e9..28ef71c81 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -479,6 +479,12 @@ chromeNode: # browserVersion: '91.0' # Optional. Only required when supporting multiple versions of browser in your Selenium Grid. unsafeSsl : 'true' # Optional + # It is used to add a 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: [] + + # Configuration for firefox nodes firefoxNode: # Enable firefox nodes @@ -593,6 +599,11 @@ firefoxNode: url: '{{ include "seleniumGrid.graphqlURL" . }}' browserName: firefox + # It is used to add a 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: [] + # Configuration for edge nodes edgeNode: # Enable edge nodes @@ -708,5 +719,10 @@ edgeNode: browserName: MicrosoftEdge sessionBrowserName: 'msedge' + # It is used to add a 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: [] + # Custom labels for k8s resources customLabels: {}