Skip to content

Selenium Grid Helm Chart #1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
788e4ee
First version of Helm chart for Selenium Grid server
pedromctech Jan 22, 2021
39e17fe
Changelog added
pedromctech Mar 11, 2021
e7507e2
Version 0.2.0 implemented (See changelog)
pedromctech Mar 11, 2021
22bfb8a
Disable components isolation by default
pedromctech Mar 13, 2021
74c1dfe
Update image tag to 4.0.0-rc-1-prerelease-20210804
ilpianista Aug 10, 2021
7eff079
Add support for tolerations
ilpianista Aug 11, 2021
2116dd5
Add support for nodeSelector
ilpianista Aug 11, 2021
b58ce06
Drop Opera from the chart
ilpianista Aug 11, 2021
c0d10c5
Fix empty value for tolerations
ilpianista Aug 23, 2021
157ab53
Add Edge nodes
ilpianista Aug 23, 2021
66a1564
Allow to add extra labels to hub, chrome, firefox and edge nodes
ilpianista Aug 24, 2021
1d1e08b
Update to 4.0.0-rc-1-prerelease-20210823
ilpianista Aug 30, 2021
3dd0de4
Update to 4.0.0-rc-1-20210902
ilpianista Sep 2, 2021
e99dca7
Update to 4.0.0-rc-2-20210930
ilpianista Oct 1, 2021
56562f6
Update to 4.0.0-rc-3-20211010
ilpianista Oct 11, 2021
54b49bb
Update to 4.0.0-20211013
ilpianista Oct 14, 2021
98dd38f
Update to 4.0.0-20211025
ilpianista Oct 26, 2021
ff924c3
Update to 4.1.0-20211123
ilpianista Nov 24, 2021
945629f
Update to 4.1.2-20220131
ilpianista Feb 3, 2022
9052b10
Update to 4.1.2-20220208
ilpianista Feb 10, 2022
4036a78
Fix queue component name (backport of 9353a18e)
ilpianista Feb 17, 2022
c8c484c
Update to 4.1.2-20220217
ilpianista Feb 18, 2022
bb778a1
Merge branch 'trunk' into selenium-grid-helm-chart-0.3.0
diemol Feb 20, 2022
fff33c1
Update chart/selenium-grid/README.md
ilpianista Feb 23, 2022
f667b97
Merge branch 'trunk' into selenium-grid-helm-chart-0.3.0
diemol Feb 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions chart/selenium-grid/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
38 changes: 38 additions & 0 deletions chart/selenium-grid/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Change Log

All notable changes to this helm chart will be documented in this file.

## :heavy_check_mark: 0.3.0

### Added
- Support for Edge nodes.
- Support for `nodeSelector`.
- Support for `tolerations`.
- Allow to add additional labels to the hub, edge, firefox and chrome nodes.
- Fix queue component name (#1290)

### Changed
- Update image tag to 4.1.2-20220217

### Removed
- Opera nodes

## :heavy_check_mark: 0.2.0

### Added
- `CHANGELOG.md`

### Changed
- Added `global` block to be able to specify component's image tag globally.
- DSHM's volume size customizable.
- Service type and service annotations are now customizable.

### Fixed
- Services won't be created if nodes are disabled.

## :heavy_check_mark: 0.1.0

### Added
- Selenium grid components separated.
- Selenium Hub server.
- Chrome, Opera and Firefox nodes.
6 changes: 6 additions & 0 deletions chart/selenium-grid/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: selenium-grid
description: A Helm chart for creating a Selenium grid server in Kubernetes
type: application
version: 0.3.0
appVersion: 4.1.2-20220217
183 changes: 183 additions & 0 deletions chart/selenium-grid/README.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions chart/selenium-grid/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Selenium Grid Server deployed succesfully.

1. Get the URL FOR WebDriver tests by running these commands:

{{- $appName := ternary "selenium-router" "selenium-hub" .Values.isolateComponents }}
{{- $serviceType := ternary .Values.components.router.serviceType .Values.hub.serviceType .Values.isolateComponents }}
{{- $port := ternary .Values.components.router.port .Values.hub.port .Values.isolateComponents }}
{{- $localUrl := ternary "http://localhost:PORT" "http://localhost:PORT/wd/hub" .Values.isolateComponents }}
{{- if contains "NodePort" $serviceType }}
export NODE_PORT=$(kubectl get -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" svc {{ include "seleniumGrid.router.fullname" . }})
export NODE_IP=$(kubectl get nodes -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" $serviceType }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get -n {{ .Release.Namespace }} svc -w {{ include "seleniumGrid.router.fullname" . }}'
export SERVICE_IP=$(kubectl get svc -n {{ .Release.Namespace }} {{ include "seleniumGrid.router.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ $port }}
{{- else if contains "ClusterIP" $serviceType }}
export POD_NAME=$(kubectl get pods -n {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ $appName }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Point your WebDriver tests to {{ $localUrl | replace "PORT" (toString $port) }}"
kubectl -n {{ .Release.Namespace }} port-forward $POD_NAME {{ $port }}:{{ $port }}
{{- end }}
73 changes: 73 additions & 0 deletions chart/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{/*
Common labels
*/}}
{{- define "seleniumGrid.commonLabels" -}}
app.kubernetes.io/managed-by: {{ .Release.Service | lower }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: {{ printf "selenium-grid-%s" .Chart.AppVersion }}
helm.sh/chart: {{ printf "%s-%s" .Chart.Name (.Chart.Version | replace "+" "_") }}
{{- end -}}

{{/*
Selenium Hub fullname
*/}}
{{- define "seleniumGrid.hub.fullname" -}}
{{- default "selenium-hub" .Values.hub.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Event bus fullname
*/}}
{{- define "seleniumGrid.eventBus.fullname" -}}
{{- default "selenium-event-bus" .Values.components.eventBus.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Router fullname
*/}}
{{- define "seleniumGrid.router.fullname" -}}
{{- default "selenium-router" .Values.components.router.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Distributor fullname
*/}}
{{- define "seleniumGrid.distributor.fullname" -}}
{{- default "selenium-distributor" .Values.components.distributor.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
SessionMap fullname
*/}}
{{- define "seleniumGrid.sessionMap.fullname" -}}
{{- default "selenium-session-map" .Values.components.sessionMap.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
SessionQueue fullname
*/}}
{{- define "seleniumGrid.sessionQueue.fullname" -}}
{{- default "selenium-session-queue" .Values.components.sessionQueue.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Chrome node fullname
*/}}
{{- define "seleniumGrid.chromeNode.fullname" -}}
{{- default "selenium-chrome-node" .Values.chromeNode.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Firefox node fullname
*/}}
{{- define "seleniumGrid.firefoxNode.fullname" -}}
{{- default "selenium-firefox-node" .Values.firefoxNode.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Edge node fullname
*/}}
{{- define "seleniumGrid.edgeNode.fullname" -}}
{{- default "selenium-edge-node" .Values.edgeNode.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
67 changes: 67 additions & 0 deletions chart/selenium-grid/templates/chrome-node-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{{- if .Values.chromeNode.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "seleniumGrid.chromeNode.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: &chrome_node_labels
app: selenium-chrome-node
app.kubernetes.io/name: selenium-chrome-node
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
{{- with .Values.chromeNode.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.customLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.chromeNode.replicas }}
selector:
matchLabels:
app: selenium-chrome-node
template:
metadata:
labels: *chrome_node_labels
annotations:
checksum/event-bus-configmap: {{ include (print $.Template.BasePath "/event-bus-configmap.yaml") . | sha256sum }}
{{- with .Values.chromeNode.annotations }}
{{ toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: selenium-chrome-node
{{- $imageTag := default .Values.global.seleniumGrid.nodesImageTag .Values.chromeNode.imageTag }}
image: {{ printf "%s:%s" .Values.chromeNode.imageName $imageTag }}
imagePullPolicy: {{ .Values.chromeNode.imagePullPolicy }}
{{- with .Values.chromeNode.extraEnvironmentVariables }}
env: {{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Values.busConfigMap.name }}
{{- if gt (len .Values.chromeNode.ports) 0 }}
ports:
{{- range .Values.chromeNode.ports }}
- containerPort: {{ . }}
protocol: TCP
{{- end }}
{{- end }}
volumeMounts:
- name: dshm
mountPath: /dev/shm
{{- with .Values.chromeNode.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.chromeNode.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.chromeNode.tolerations }}
tolerations:
{{ toYaml . | nindent 6 }}
{{- end }}
volumes:
- name: dshm
emptyDir:
medium: Memory
sizeLimit: {{ default "1Gi" .Values.chromeNode.dshmVolumeSizeLimit }}
{{- end }}
23 changes: 23 additions & 0 deletions chart/selenium-grid/templates/chrome-node-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if and .Values.chromeNode.enabled .Values.chromeNode.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "seleniumGrid.chromeNode.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
name: selenium-chrome-node
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
{{- with .Values.chromeNode.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.chromeNode.service.type }}
selector:
app: selenium-chrome-node
ports:
- name: tcp-chrome
protocol: TCP
port: {{ .Values.chromeNode.seleniumServicePort }}
targetPort: {{ .Values.chromeNode.seleniumPort }}
{{- end }}
59 changes: 59 additions & 0 deletions chart/selenium-grid/templates/distributor-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{- if .Values.isolateComponents }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "seleniumGrid.distributor.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: &distributor_labels
app: selenium-distributor
app.kubernetes.io/name: selenium-distributor
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
{{- with .Values.customLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: 1
selector:
matchLabels:
app: selenium-distributor
template:
metadata:
labels: *distributor_labels
{{- with .Values.components.distributor.annotations }}
annotations: {{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: selenium-distributor
{{- $imageTag := default .Values.global.seleniumGrid.imageTag .Values.components.distributor.imageTag }}
image: {{ printf "%s:%s" .Values.components.distributor.imageName $imageTag }}
imagePullPolicy: {{ .Values.components.distributor.imagePullPolicy }}
env:
- name: SE_SESSIONS_MAP_HOST
value: {{ template "seleniumGrid.sessionMap.fullname" . }}
- name: SE_SESSIONS_MAP_PORT
value: {{ .Values.components.sessionMap.port | quote }}
- name: SE_SESSION_QUEUE_HOST
value: {{ template "seleniumGrid.sessionQueue.fullname" . }}
- name: SE_SESSION_QUEUE_PORT
value: {{ .Values.components.sessionQueue.port | quote }}
{{- with .Values.components.extraEnvironmentVariables }}
{{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: {{ .Values.busConfigMap.name }}
ports:
- containerPort: {{ .Values.components.distributor.port }}
protocol: TCP
{{- with .Values.components.distributor.resources }}
resources: {{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.components.distributor.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.components.distributor.tolerations }}
tolerations:
{{ toYaml . | nindent 6 }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions chart/selenium-grid/templates/distributor-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.isolateComponents }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "seleniumGrid.distributor.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: selenium-distributor
{{- include "seleniumGrid.commonLabels" . | nindent 4 }}
{{- with .Values.customLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.components.distributor.serviceAnnotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
app: selenium-distributor
type: {{ .Values.components.distributor.serviceType }}
ports:
- name: tcp-dist
protocol: TCP
port: {{ .Values.components.distributor.port }}
targetPort: {{ .Values.components.distributor.port }}
{{- end }}
Loading