-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autoscaling selenium grid on kubernetes with scaledjobs (#1854)
* Autoscaling selenium grid on kubernetes Autoscale selenium browser nodes running in kubernetes based on the request pending in session queue using KEDA. Toggle autoscaling on/off using 'autoscalingEnabled' option in helm charts. * Added all suggested changes * feat: add support for KEDA ScaledJobs and make them the default KEDA scaling type install keda automatically set SE_NODE_GRID_URL and DRAIN_AFTER_SESSION_COUNT automatically Set graphqlurl automatically refactor out pod templates to named template conditionally adding preStop hook for deregistering node Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se> * fix: work around for limitations in helm helm seem to normally install subchart after current chart so trying this work around * fix: format * fix: extracting default node env variables to configmap --------- Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se> Co-authored-by: Prashanth R <prashanth.ramadass@volvocars.com> Co-authored-by: Prashanth R <rprashanth27@gmail.com>
- Loading branch information
1 parent
33bd1ab
commit f0bbfe0
Showing
14 changed files
with
587 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{- if and .Values.chromeNode.enabled (eq (include "seleniumGrid.useKEDA" .) "true") (eq .Values.autoscaling.scalingType "deployment") }} | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledObject | ||
metadata: | ||
name: selenium-grid-chrome-scaledobject | ||
namespace: {{ .Release.Namespace }} | ||
annotations: | ||
{{- with .Values.autoscaling.annotations }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
deploymentName: {{ template "seleniumGrid.chromeNode.fullname" . }} | ||
spec: | ||
maxReplicaCount: {{ .Values.chromeNode.maxReplicaCount }} | ||
scaleTargetRef: | ||
name: {{ template "seleniumGrid.chromeNode.fullname" . }} | ||
triggers: | ||
- type: selenium-grid | ||
{{- with .Values.chromeNode.hpa }} | ||
metadata: {{- tpl (toYaml .) $ | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
39 changes: 39 additions & 0 deletions
39
charts/selenium-grid/templates/chrome-node-scaledjobs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{- if and .Values.chromeNode.enabled (include "seleniumGrid.useKEDA" .) (eq .Values.autoscaling.scalingType "job") }} | ||
apiVersion: keda.sh/v1alpha1 | ||
kind: ScaledJob | ||
metadata: | ||
name: {{ template "seleniumGrid.chromeNode.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
annotations: | ||
{{- with .Values.autoscaling.annotations }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
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: | ||
maxReplicaCount: {{ .Values.chromeNode.maxReplicaCount }} | ||
{{- with .Values.autoscaling.scaledJobOptions -}} | ||
{{ toYaml . | nindent 2 }} | ||
{{- end }} | ||
triggers: | ||
- type: selenium-grid | ||
{{- with .Values.chromeNode.hpa }} | ||
metadata: {{- tpl (toYaml .) $ | nindent 8 }} | ||
{{- end }} | ||
jobTargetRef: | ||
parallelism: 1 | ||
completions: 1 | ||
backoffLimit: 0 | ||
{{- $podScope := deepCopy . -}} | ||
{{- $_ := set $podScope "name" "selenium-chrome-node" -}} | ||
{{- $_ = set $podScope "node" .Values.chromeNode -}} | ||
{{- include "seleniumGrid.podTemplate" $podScope | nindent 4 }} | ||
{{- end }} |
Oops, something went wrong.