Skip to content

Commit

Permalink
fix: extracting default node env variables to configmap
Browse files Browse the repository at this point in the history
  • Loading branch information
msvticket committed Jun 28, 2023
1 parent 7d17924 commit 04ff13d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
10 changes: 6 additions & 4 deletions charts/selenium-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ This table contains the configuration parameters of the chart and their default
| --------------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `isolateComponents` | `false` | Deploy Router, Distributor, EventBus, SessionMap and Nodes separately |
| `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.annotations` | `{}` | Custom annotations for configmap |
| `nodeConfigMap.name` | `selenium-node-config` | 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 |
| `ingress.annotations` | `{}` | Custom annotations for ingress resource |
| `ingress.hostname` | `selenium-grid.local` | Default host for the ingress resource |
| `ingress.path` | `/` | Default host path for the ingress resource |
| `ingress.tls` | `[]` | TLS backend configuration for ingress resource |
| `busConfigMap.annotations` | `{}` | Custom annotations for configmap |
| `autoscaling.enableWithExistingKEDA` | `false` | Enable autoscaling of browser nodes. |
| `autoscaling.enabled` | `false` | Same as above plus installation of KEDA |
| `autoscaling.scalingType` | `job` | Which typ of KEDA scaling to use: job or deployment |
Expand All @@ -118,7 +120,7 @@ This table contains the configuration parameters of the chart and their default
| `chromeNode.affinity` | `{}` | Affinity for chrome-node pods |
| `chromeNode.hostAliases` | `nil` | Custom host aliases for chrome nodes |
| `chromeNode.priorityClassName` | `""` | Priority class name for chrome-node pods |
| `chromeNode.extraEnvironmentVariables` | See `values.yaml` | Environment variables for chrome nodes |
| `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 |
Expand Down Expand Up @@ -152,7 +154,7 @@ This table contains the configuration parameters of the chart and their default
| `firefoxNode.affinity` | `{}` | Affinity for firefox-node pods |
| `firefoxNode.hostAliases` | `nil` | Custom host aliases for firefox nodes |
| `firefoxNode.priorityClassName` | `""` | Priority class name for firefox-node pods |
| `firefoxNode.extraEnvironmentVariables` | See `values.yaml` | Environment variables for firefox nodes |
| `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 |
Expand Down Expand Up @@ -186,7 +188,7 @@ This table contains the configuration parameters of the chart and their default
| `edgeNode.affinity` | `{}` | Affinity for edge-node pods |
| `edgeNode.hostAliases` | `nil` | Custom host aliases for edge nodes |
| `edgeNode.priorityClassName` | `""` | Priority class name for edge-node pods |
| `edgeNode.extraEnvironmentVariables` | See `values.yaml` | Environment variables for firefox nodes |
| `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 |
Expand Down
2 changes: 2 additions & 0 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ template:
envFrom:
- configMapRef:
name: {{ .Values.busConfigMap.name }}
- configMapRef:
name: {{ .Values.nodeConfigMap.name }}
{{- with .node.extraEnvFrom }}
{{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
16 changes: 16 additions & 0 deletions charts/selenium-grid/templates/node-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.nodeConfigMap.name }}
namespace: {{ .Release.Namespace }}
{{- with .Values.nodeConfigMap.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
{{- with .Values.customLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
data:
DRAIN_AFTER_SESSION_COUNT: '{{- and (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "job") | ternary "1" "0" -}}'
SE_NODE_GRID_URL: '{{ include "seleniumGrid.url" .}}'
18 changes: 6 additions & 12 deletions charts/selenium-grid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ busConfigMap:
# Custom annotations for configmap
annotations: {}

# ConfigMap that contains common environment variables for browser nodes
nodeConfigMap:
name: selenium-node-config
# Custom annotations for configmap
annotations: {}

# Configuration for isolated components (applied only if `isolateComponents: true`)
components:

Expand Down Expand Up @@ -390,10 +396,6 @@ chromeNode:
# - "example.org"
# Custom environment variables for chrome nodes
extraEnvironmentVariables:
- name: DRAIN_AFTER_SESSION_COUNT
value: '{{- and (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "job") | ternary "1" "0" -}}'
- name: SE_NODE_GRID_URL
value: '{{ include "seleniumGrid.url" .}}'
# - name: SE_JAVA_OPTS
# value: "-Xmx512m"
# - name:
Expand Down Expand Up @@ -506,10 +508,6 @@ firefoxNode:
# - "example.org"
# Custom environment variables for firefox nodes
extraEnvironmentVariables:
- name: DRAIN_AFTER_SESSION_COUNT
value: '{{- and (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "job") | ternary "1" "0" -}}'
- name: SE_NODE_GRID_URL
value: '{{ include "seleniumGrid.url" .}}'
# - name: SE_JAVA_OPTS
# value: "-Xmx512m"
# - name:
Expand Down Expand Up @@ -618,10 +616,6 @@ edgeNode:
# - "example.org"
# Custom environment variables for edge nodes
extraEnvironmentVariables:
- name: DRAIN_AFTER_SESSION_COUNT
value: '{{- and (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "job") | ternary "1" "0" -}}'
- name: SE_NODE_GRID_URL
value: '{{ include "seleniumGrid.url" .}}'
# - name: SE_JAVA_OPTS
# value: "-Xmx512m"
# - name:
Expand Down

0 comments on commit 04ff13d

Please sign in to comment.