Skip to content

Commit 4f2a6e4

Browse files
committed
chart(add): set topologySpreadConstraints for components
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent 80ebff0 commit 4f2a6e4

12 files changed

+187
-15
lines changed

Diff for: charts/selenium-grid/CONFIGURATION.md

+20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
4444
| global.seleniumGrid.httpLogs | bool | `false` | Enable http logging. Tracing should be enabled to log http logs. |
4545
| global.seleniumGrid.updateStrategy.type | string | `"Recreate"` | Specify update strategy for all components, can be overridden individually |
4646
| global.seleniumGrid.updateStrategy.rollingUpdate | object | `{"maxSurge":1,"maxUnavailable":0}` | Specify for strategy RollingUpdate |
47+
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
48+
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |
4749
| tls.nameOverride | string | `nil` | Name of external secret containing the TLS certificate and key |
4850
| tls.enabled | bool | `false` | Enable or disable TLS for the server components (and ingress proxy) |
4951
| tls.ingress.enabled | bool | `false` | Enable or disable TLS for the ingress proxy only |
@@ -158,6 +160,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
158160
| components.router.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
159161
| components.router.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
160162
| components.router.disableUI | bool | `false` | Disable the Grid UI |
163+
| components.router.affinity | object | `{}` | Specify affinity for router pods, this overwrites global.seleniumGrid.affinity parameter |
164+
| components.router.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for router pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
161165
| components.router.annotations | object | `{}` | Custom annotations for router pods |
162166
| components.router.port | int | `4444` | Router container port |
163167
| components.router.nodePort | int | `30444` | Router expose NodePort |
@@ -178,6 +182,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
178182
| components.distributor.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
179183
| components.distributor.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
180184
| components.distributor.newSessionThreadPoolSize | string | `nil` | Configure fixed-sized thread pool for the Distributor to create new sessions as it consumes new session requests from the queue |
185+
| components.distributor.affinity | object | `{}` | Specify affinity for distributor pods, this overwrites global.seleniumGrid.affinity parameter |
186+
| components.distributor.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Distributor pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
181187
| components.distributor.annotations | object | `{}` | Custom annotations for Distributor pods |
182188
| components.distributor.port | int | `5553` | Distributor container port |
183189
| components.distributor.nodePort | int | `30553` | Distributor expose NodePort |
@@ -196,6 +202,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
196202
| components.eventBus.imageTag | string | `nil` | Event Bus image tag (this overwrites global.seleniumGrid.imageTag parameter) |
197203
| components.eventBus.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
198204
| components.eventBus.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
205+
| components.eventBus.affinity | object | `{}` | Specify affinity for Event Bus pods, this overwrites global.seleniumGrid.affinity parameter |
206+
| components.eventBus.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Event Bus pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
199207
| components.eventBus.annotations | object | `{}` | Custom annotations for Event Bus pods |
200208
| components.eventBus.port | int | `5557` | Event Bus container port |
201209
| components.eventBus.nodePort | int | `30557` | Event Bus expose NodePort |
@@ -215,6 +223,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
215223
| components.sessionMap.imageTag | string | `nil` | Session Map image tag (this overwrites global.seleniumGrid.imageTag parameter) |
216224
| components.sessionMap.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
217225
| components.sessionMap.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
226+
| components.sessionMap.affinity | object | `{}` | Specify affinity for Session Map pods, this overwrites global.seleniumGrid.affinity parameter |
227+
| components.sessionMap.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Session Map pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
218228
| components.sessionMap.annotations | object | `{}` | Custom annotations for Session Map pods |
219229
| components.sessionMap.port | int | `5556` | Session Map container port |
220230
| components.sessionMap.resources | object | `{}` | Resources for Session Map container |
@@ -229,6 +239,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
229239
| components.sessionQueue.imageTag | string | `nil` | Session Queue image tag (this overwrites global.seleniumGrid.imageTag parameter) |
230240
| components.sessionQueue.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
231241
| components.sessionQueue.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
242+
| components.sessionQueue.affinity | object | `{}` | Specify affinity for Session Queue pods, this overwrites global.seleniumGrid.affinity parameter |
243+
| components.sessionQueue.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Session Queue pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
232244
| components.sessionQueue.annotations | object | `{}` | Custom annotations for Session Queue pods |
233245
| components.sessionQueue.port | int | `5559` | Session Queue container port |
234246
| components.sessionQueue.nodePort | int | `30559` | Session Queue expose NodePort |
@@ -247,6 +259,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
247259
| hub.imageTag | string | `nil` | Selenium Hub image tag (this overwrites global.seleniumGrid.imageTag parameter) |
248260
| hub.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
249261
| hub.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
262+
| hub.affinity | object | `{}` | Specify affinity for Selenium Hub pods, this overwrites global.seleniumGrid.affinity parameter |
263+
| hub.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Hub pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
250264
| hub.annotations | object | `{}` | Custom annotations for Selenium Hub pods |
251265
| hub.labels | object | `{}` | Custom labels for Selenium Hub pods |
252266
| hub.disableUI | bool | `false` | Disable the Grid UI |
@@ -313,6 +327,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
313327
| chromeNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
314328
| chromeNode.port | int | `5555` | Node component port |
315329
| chromeNode.nodePort | string | `nil` | Node component expose NodePort |
330+
| chromeNode.affinity | object | `{}` | Specify affinity for chrome-node pods, this overwrites global.seleniumGrid.affinity parameter |
331+
| chromeNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for chrome-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
316332
| chromeNode.annotations | object | `{}` | Annotations for chrome-node pods |
317333
| chromeNode.labels | object | `{}` | Labels for chrome-node pods |
318334
| chromeNode.shareProcessNamespace | bool | `true` | Shared process namespace for chrome-node pods |
@@ -361,6 +377,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
361377
| firefoxNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
362378
| firefoxNode.port | int | `5555` | Node component port |
363379
| firefoxNode.nodePort | string | `nil` | Node component expose NodePort |
380+
| firefoxNode.affinity | object | `{}` | Specify affinity for firefox-node pods, this overwrites global.seleniumGrid.affinity parameter |
381+
| firefoxNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for firefox-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
364382
| firefoxNode.annotations | object | `{}` | Annotations for firefox-node pods |
365383
| firefoxNode.labels | object | `{}` | Labels for firefox-node pods |
366384
| firefoxNode.tolerations | list | `[]` | Tolerations for firefox-node pods |
@@ -409,6 +427,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
409427
| edgeNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
410428
| edgeNode.port | int | `5555` | Node component port |
411429
| edgeNode.nodePort | string | `nil` | Node component expose NodePort |
430+
| edgeNode.affinity | object | `{}` | Specify affinity for edge-node pods, this overwrites global.seleniumGrid.affinity parameter |
431+
| edgeNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for edge-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
412432
| edgeNode.annotations | object | `{}` | Annotations for edge-node pods |
413433
| edgeNode.labels | object | `{}` | Labels for edge-node pods |
414434
| edgeNode.tolerations | list | `[]` | Tolerations for edge-node pods |

Diff for: charts/selenium-grid/templates/_helpers.tpl

+16-2
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,22 @@ template:
546546
{{- with .node.nodeSelector }}
547547
nodeSelector: {{- toYaml . | nindent 6 }}
548548
{{- end }}
549-
{{- with .node.affinity }}
550-
affinity: {{- toYaml . | nindent 6 }}
549+
{{- if or $.Values.global.seleniumGrid.affinity .node.affinity }}
550+
{{- $affinityYaml := default $.Values.global.seleniumGrid.affinity .node.affinity }}
551+
affinity: {{- toYaml $affinityYaml | nindent 6 }}
552+
{{- end }}
553+
{{- if or $.Values.global.seleniumGrid.topologySpreadConstraints .node.topologySpreadConstraints }}
554+
{{- $topologySpreadConstraints := default $.Values.global.seleniumGrid.topologySpreadConstraints .node.topologySpreadConstraints }}
555+
{{- $appName := .name }}
556+
topologySpreadConstraints:
557+
{{- range $constraint := $topologySpreadConstraints }}
558+
- {{ toYaml $constraint | nindent 8 | trim }}
559+
{{- if not $constraint.labelSelector }}
560+
labelSelector:
561+
matchLabels:
562+
app: {{ $appName }}
563+
{{- end }}
564+
{{- end }}
551565
{{- end }}
552566
{{- with .node.tolerations }}
553567
tolerations:

Diff for: charts/selenium-grid/templates/distributor-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,19 @@ spec:
173173
{{- if or .Values.global.seleniumGrid.affinity .Values.components.distributor.affinity }}
174174
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.distributor.affinity }}
175175
affinity: {{- toYaml $affinityYaml | nindent 8 }}
176-
{{- end }}
176+
{{- end }}
177+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
178+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
179+
topologySpreadConstraints:
180+
{{- range $constraint := $topologySpreadConstraints }}
181+
- {{ toYaml $constraint | nindent 10 | trim }}
182+
{{- if not $constraint.labelSelector }}
183+
labelSelector:
184+
matchLabels:
185+
app: {{ template "seleniumGrid.distributor.fullname" $ }}
186+
{{- end }}
187+
{{- end }}
188+
{{- end }}
177189
{{- with .Values.components.distributor.tolerations }}
178190
tolerations: {{ toYaml . | nindent 6 }}
179191
{{- end }}

Diff for: charts/selenium-grid/templates/event-bus-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,19 @@ spec:
8484
{{- if or .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
8585
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
8686
affinity: {{- toYaml $affinityYaml | nindent 8 }}
87-
{{- end }}
87+
{{- end }}
88+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
89+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
90+
topologySpreadConstraints:
91+
{{- range $constraint := $topologySpreadConstraints }}
92+
- {{ toYaml $constraint | nindent 10 | trim }}
93+
{{- if not $constraint.labelSelector }}
94+
labelSelector:
95+
matchLabels:
96+
app: {{ template "seleniumGrid.eventBus.fullname" $ }}
97+
{{- end }}
98+
{{- end }}
99+
{{- end }}
88100
{{- with .Values.components.eventBus.tolerations }}
89101
tolerations: {{ toYaml . | nindent 6 }}
90102
{{- end }}

Diff for: charts/selenium-grid/templates/hub-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,19 @@ spec:
173173
{{- if or .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
174174
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
175175
affinity: {{- toYaml $affinityYaml | nindent 8 }}
176-
{{- end }}
176+
{{- end }}
177+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
178+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
179+
topologySpreadConstraints:
180+
{{- range $constraint := $topologySpreadConstraints }}
181+
- {{ toYaml $constraint | nindent 10 | trim }}
182+
{{- if not $constraint.labelSelector }}
183+
labelSelector:
184+
matchLabels:
185+
app: {{ template "seleniumGrid.hub.fullname" $ }}
186+
{{- end }}
187+
{{- end }}
188+
{{- end }}
177189
{{- with .Values.hub.tolerations }}
178190
tolerations: {{ toYaml . | nindent 6 }}
179191
{{- end }}

Diff for: charts/selenium-grid/templates/router-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,19 @@ spec:
157157
{{- if or .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
158158
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
159159
affinity: {{- toYaml $affinityYaml | nindent 8 }}
160-
{{- end }}
160+
{{- end }}
161+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
162+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
163+
topologySpreadConstraints:
164+
{{- range $constraint := $topologySpreadConstraints }}
165+
- {{ toYaml $constraint | nindent 10 | trim }}
166+
{{- if not $constraint.labelSelector }}
167+
labelSelector:
168+
matchLabels:
169+
app: {{ template "seleniumGrid.router.fullname" $ }}
170+
{{- end }}
171+
{{- end }}
172+
{{- end }}
161173
{{- with .Values.components.router.tolerations }}
162174
tolerations: {{ toYaml . | nindent 6 }}
163175
{{- end }}

Diff for: charts/selenium-grid/templates/session-map-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,19 @@ spec:
8383
{{- if or .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
8484
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
8585
affinity: {{- toYaml $affinityYaml | nindent 8 }}
86-
{{- end }}
86+
{{- end }}
87+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
88+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
89+
topologySpreadConstraints:
90+
{{- range $constraint := $topologySpreadConstraints }}
91+
- {{ toYaml $constraint | nindent 10 | trim }}
92+
{{- if not $constraint.labelSelector }}
93+
labelSelector:
94+
matchLabels:
95+
app: {{ template "seleniumGrid.sessionMap.fullname" $ }}
96+
{{- end }}
97+
{{- end }}
98+
{{- end }}
8799
{{- with .Values.components.sessionMap.tolerations }}
88100
tolerations: {{ toYaml . | nindent 6 }}
89101
{{- end }}

Diff for: charts/selenium-grid/templates/session-queue-deployment.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,19 @@ spec:
8080
{{- if or .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
8181
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
8282
affinity: {{- toYaml $affinityYaml | nindent 8 }}
83-
{{- end }}
83+
{{- end }}
84+
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
85+
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
86+
topologySpreadConstraints:
87+
{{- range $constraint := $topologySpreadConstraints }}
88+
- {{ toYaml $constraint | nindent 10 | trim }}
89+
{{- if not $constraint.labelSelector }}
90+
labelSelector:
91+
matchLabels:
92+
app: {{ template "seleniumGrid.sessionQueue.fullname" $ }}
93+
{{- end }}
94+
{{- end }}
95+
{{- end }}
8496
{{- with .Values.components.sessionQueue.tolerations }}
8597
tolerations: {{ toYaml . | nindent 6 }}
8698
{{- end }}

0 commit comments

Comments
 (0)