From db98b377b4a0aff8dcf6c1f9aa8c4098578ba273 Mon Sep 17 00:00:00 2001 From: Zadjad Rezai <38798281+Xcalizorz@users.noreply.github.com> Date: Mon, 14 Mar 2022 14:21:30 +0100 Subject: [PATCH] Add ability to insert entire configmap/secret into env. (#1521) --- chart/selenium-grid/README.md | 5 +++ .../templates/chrome-node-deployment.yaml | 3 ++ .../templates/distributor-deployment.yaml | 3 ++ .../templates/edge-node-deployment.yaml | 3 ++ .../templates/event-bus-deployment.yaml | 4 +++ .../templates/firefox-node-deployment.yaml | 3 ++ .../templates/hub-deployment.yaml | 4 +++ .../templates/router-deployment.yaml | 4 +++ .../templates/session-map-deployment.yaml | 3 ++ .../templates/session-queuer-deployment.yaml | 3 ++ chart/selenium-grid/values.yaml | 33 ++++++++++++++++++- 11 files changed, 67 insertions(+), 1 deletion(-) diff --git a/chart/selenium-grid/README.md b/chart/selenium-grid/README.md index 2003df71f..8f9392e5f 100644 --- a/chart/selenium-grid/README.md +++ b/chart/selenium-grid/README.md @@ -63,6 +63,7 @@ This table contains the configuration parameters of the chart and their default | `chromeNode.tolerations` | `[]` | Tolerations for chrome-node container | | `chromeNode.nodeSelector` | `{}` | Node Selector for chrome-node container | | `chromeNode.extraEnvironmentVariables` | `nil` | Custom environment variables for chrome nodes | +| `chromeNode.extraEnvFrom` | `nil` | Custom environment taken from `configMap` or `secret` variables for chrome nodes | | `chromeNode.service.enabled` | `true` | Create a service for node | | `chromeNode.service.type` | `ClusterIP` | Service type | | `chromeNode.service.annotations` | `{}` | Custom annotations for service | @@ -81,6 +82,7 @@ This table contains the configuration parameters of the chart and their default | `firefoxNode.tolerations` | `[]` | Tolerations for firefox-node container | | `firefoxNode.nodeSelector` | `{}` | Node Selector for firefox-node container | | `firefoxNode.extraEnvironmentVariables` | `nil` | Custom environment variables for firefox nodes | +| `firefoxNode.extraEnvFrom` | `nil` | Custom environment variables taken from `configMap` or `secret` for firefox nodes | | `firefoxNode.service.enabled` | `true` | Create a service for node | | `firefoxNode.service.type` | `ClusterIP` | Service type | | `firefoxNode.service.annotations` | `{}` | Custom annotations for service | @@ -99,6 +101,7 @@ This table contains the configuration parameters of the chart and their default | `edgeNode.tolerations` | `[]` | Tolerations for edge-node container | | `edgeNode.nodeSelector` | `{}` | Node Selector for edge-node container | | `edgeNode.extraEnvironmentVariables` | `nil` | Custom environment variables for firefox nodes | +| `edgeNode.extraEnvFrom` | `nil` | Custom environment taken from `configMap` or `secret` variables for firefox nodes | | `edgeNode.service.enabled` | `true` | Create a service for node | | `edgeNode.service.type` | `ClusterIP` | Service type | | `edgeNode.service.annotations` | `{}` | Custom annotations for service | @@ -125,6 +128,7 @@ You can configure the Selenium Hub with this values: | `hub.tolerations` | `[]` | Tolerations for selenium-hub container | | `hub.nodeSelector` | `{}` | Node Selector for selenium-hub container | | `hub.extraEnvironmentVariables` | `nil` | Custom environment variables for selenium-hub | +| `hub.extraEnvFrom` | `nil` | Custom environment variables for selenium taken from `configMap` or `secret`-hub | | `hub.resources` | `{}` | Resources for selenium-hub container | | `hub.serviceType` | `NodePort` | Kubernetes service type (see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | | `hub.serviceAnnotations` | `{}` | Custom annotations for Selenium Hub service | @@ -179,5 +183,6 @@ If you implement selenium-grid with separate components (`isolateComponents: tru | `components.sessionQueue.serviceType` | `ClusterIP` | Kubernetes service type (see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) | | `components.sessionQueue.serviceAnnotations` | `{}` | Custom annotations for Session Queue service | | `components.extraEnvironmentVariables` | `nil` | Custom environment variables for all components | +| `components.extraEnvFrom` | `nil` | Custom environment variables taken from `configMap` or `secret` for all components | See how to customize a helm chart installation in the [Helm Docs](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing) for more information. diff --git a/chart/selenium-grid/templates/chrome-node-deployment.yaml b/chart/selenium-grid/templates/chrome-node-deployment.yaml index e80b872b4..a6b9e1601 100644 --- a/chart/selenium-grid/templates/chrome-node-deployment.yaml +++ b/chart/selenium-grid/templates/chrome-node-deployment.yaml @@ -39,6 +39,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.chromeNode.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- if gt (len .Values.chromeNode.ports) 0 }} ports: {{- range .Values.chromeNode.ports }} diff --git a/chart/selenium-grid/templates/distributor-deployment.yaml b/chart/selenium-grid/templates/distributor-deployment.yaml index 103711b61..0c96041da 100644 --- a/chart/selenium-grid/templates/distributor-deployment.yaml +++ b/chart/selenium-grid/templates/distributor-deployment.yaml @@ -43,6 +43,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.components.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} ports: - containerPort: {{ .Values.components.distributor.port }} protocol: TCP diff --git a/chart/selenium-grid/templates/edge-node-deployment.yaml b/chart/selenium-grid/templates/edge-node-deployment.yaml index 7db3e4640..0263a9b5a 100644 --- a/chart/selenium-grid/templates/edge-node-deployment.yaml +++ b/chart/selenium-grid/templates/edge-node-deployment.yaml @@ -39,6 +39,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.edgeNode.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- if gt (len .Values.edgeNode.ports) 0 }} ports: {{- range .Values.edgeNode.ports }} diff --git a/chart/selenium-grid/templates/event-bus-deployment.yaml b/chart/selenium-grid/templates/event-bus-deployment.yaml index 1b231a1b1..21f334bcb 100644 --- a/chart/selenium-grid/templates/event-bus-deployment.yaml +++ b/chart/selenium-grid/templates/event-bus-deployment.yaml @@ -38,6 +38,10 @@ spec: {{- with .Values.components.extraEnvironmentVariables }} env: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} + envFrom: + {{- with .Values.components.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.components.eventBus.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} diff --git a/chart/selenium-grid/templates/firefox-node-deployment.yaml b/chart/selenium-grid/templates/firefox-node-deployment.yaml index 64fc06ab7..c0d75315a 100644 --- a/chart/selenium-grid/templates/firefox-node-deployment.yaml +++ b/chart/selenium-grid/templates/firefox-node-deployment.yaml @@ -39,6 +39,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.firefoxNode.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- if gt (len .Values.firefoxNode.ports) 0 }} ports: {{- range .Values.firefoxNode.ports }} diff --git a/chart/selenium-grid/templates/hub-deployment.yaml b/chart/selenium-grid/templates/hub-deployment.yaml index 8a835032c..bd50022a2 100644 --- a/chart/selenium-grid/templates/hub-deployment.yaml +++ b/chart/selenium-grid/templates/hub-deployment.yaml @@ -63,6 +63,10 @@ spec: {{- with .Values.hub.extraEnvironmentVariables }} env: {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} + envFrom: + {{- with .Values.hub.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.hub.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} diff --git a/chart/selenium-grid/templates/router-deployment.yaml b/chart/selenium-grid/templates/router-deployment.yaml index bebad1961..f8d510319 100644 --- a/chart/selenium-grid/templates/router-deployment.yaml +++ b/chart/selenium-grid/templates/router-deployment.yaml @@ -44,6 +44,10 @@ spec: {{- with .Values.components.extraEnvironmentVariables }} {{- tpl (toYaml .) $ | nindent 12 }} {{- end }} + envFrom: + {{- with .Values.components.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} ports: - containerPort: {{ .Values.components.router.port }} protocol: TCP diff --git a/chart/selenium-grid/templates/session-map-deployment.yaml b/chart/selenium-grid/templates/session-map-deployment.yaml index f077e4c00..4dd3467af 100644 --- a/chart/selenium-grid/templates/session-map-deployment.yaml +++ b/chart/selenium-grid/templates/session-map-deployment.yaml @@ -34,6 +34,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.components.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} ports: - containerPort: {{ .Values.components.sessionMap.port }} protocol: TCP diff --git a/chart/selenium-grid/templates/session-queuer-deployment.yaml b/chart/selenium-grid/templates/session-queuer-deployment.yaml index 8c99d4ccc..661f7d271 100644 --- a/chart/selenium-grid/templates/session-queuer-deployment.yaml +++ b/chart/selenium-grid/templates/session-queuer-deployment.yaml @@ -34,6 +34,9 @@ spec: envFrom: - configMapRef: name: {{ .Values.busConfigMap.name }} + {{- with .Values.components.extraEnvFrom }} + {{- toYaml . | nindent 12 }} + {{- end }} ports: - containerPort: {{ .Values.components.sessionQueue.port }} protocol: TCP diff --git a/chart/selenium-grid/values.yaml b/chart/selenium-grid/values.yaml index 3f1089101..dadc04bfa 100644 --- a/chart/selenium-grid/values.yaml +++ b/chart/selenium-grid/values.yaml @@ -168,6 +168,13 @@ components: # name: secret-name # key: secret-key + # Custom environment variables by sourcing entire configMap, Secret, etc. for all components + extraEnvFrom: + # - configMapRef: + # name: proxy-settings + # - secretRef: + # name: mysecret + # Configuration for selenium hub deployment (applied only if `isolateComponents: false`) hub: # Selenium Hub image name @@ -213,6 +220,12 @@ hub: # secretKeyRef: # name: secret-name # key: secret-key + # Custom environment variables by sourcing entire configMap, Secret, etc. for selenium-hub + extraEnvFrom: + # - configMapRef: + # name: proxy-settings + # - secretRef: + # name: mysecret # Resources for selenium-hub container resources: {} # Kubernetes service type (see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types) @@ -268,6 +281,12 @@ chromeNode: # secretKeyRef: # name: secret-name # key: secret-key + # Custom environment variables by sourcing entire configMap, Secret, etc. for chrome nodes + extraEnvFrom: + # - configMapRef: + # name: proxy-settings + # - secretRef: + # name: mysecret # Service configuration service: # Create a service for node @@ -323,6 +342,12 @@ firefoxNode: # secretKeyRef: # name: secret-name # key: secret-key + # Custom environment variables by sourcing entire configMap, Secret, etc. for firefox nodes + extraEnvFrom: + # - configMapRef: + # name: proxy-settings + # - secretRef: + # name: mysecret # Service configuration service: # Create a service for node @@ -368,7 +393,7 @@ edgeNode: limits: memory: "1Gi" cpu: "1" - # Custom environment variables for firefox nodes + # Custom environment variables for edge nodes extraEnvironmentVariables: # - name: JAVA_OPTS # value: "-Xmx512m" @@ -377,6 +402,12 @@ edgeNode: # secretKeyRef: # name: secret-name # key: secret-key + # Custom environment variables by sourcing entire configMap, Secret, etc. for edge nodes + extraEnvFrom: + # - configMapRef: + # name: proxy-settings + # - secretRef: + # name: mysecret # Service configuration service: # Create a service for node