Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,22 @@ Component update strategy template
{{ $spec | nindent 4 }}
{{- end -}}

{{/*
Replica count for a distributed component (Distributor, SessionQueue, SessionMap).
The value from `.replicas` is honored only when the component's external datastore is
enabled, since replicas share state through it. Without an external datastore, running
multiple replicas would break the grid (no shared state), so the count is forced to 1.
Pass the component config, e.g. `.Values.components.distributor`.
*/}}
{{- define "seleniumGrid.component.replicaCount" -}}
{{- $component := . -}}
{{- if (dig "externalDatastore" "enabled" false $component) -}}
{{- max 1 ($component.replicas | int) -}}
{{- else -}}
1
{{- end -}}
{{- end -}}

{{/*
Common pod template
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/distributor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.components.distributor $.Values.global.seleniumGrid) }}
replicas: {{ max 1 (.Values.components.distributor.replicas | int) }}
replicas: {{ include "seleniumGrid.component.replicaCount" .Values.components.distributor }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
2 changes: 1 addition & 1 deletion charts/selenium-grid/templates/session-map-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.components.sessionMap $.Values.global.seleniumGrid) }}
replicas: {{ max 1 (.Values.components.sessionMap.replicas | int) }}
replicas: {{ include "seleniumGrid.component.replicaCount" .Values.components.sessionMap }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
spec:
strategy:
{{- template "seleniumGrid.updateStrategy" (list $.Values.components.sessionQueue $.Values.global.seleniumGrid) }}
replicas: {{ max 1 (.Values.components.sessionQueue.replicas | int) }}
replicas: {{ include "seleniumGrid.component.replicaCount" .Values.components.sessionQueue }}
revisionHistoryLimit: {{ .Values.global.seleniumGrid.revisionHistoryLimit }}
selector:
matchLabels:
Expand Down
Loading