Skip to content

Commit

Permalink
chart(add): set topologySpreadConstraints for components
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Sep 3, 2024
1 parent 80ebff0 commit 4f2a6e4
Show file tree
Hide file tree
Showing 12 changed files with 187 additions and 15 deletions.
20 changes: 20 additions & 0 deletions charts/selenium-grid/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| global.seleniumGrid.httpLogs | bool | `false` | Enable http logging. Tracing should be enabled to log http logs. |
| global.seleniumGrid.updateStrategy.type | string | `"Recreate"` | Specify update strategy for all components, can be overridden individually |
| global.seleniumGrid.updateStrategy.rollingUpdate | object | `{"maxSurge":1,"maxUnavailable":0}` | Specify for strategy RollingUpdate |
| global.seleniumGrid.affinity | object | `{}` | Specify affinity for all components, can be overridden individually |
| global.seleniumGrid.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for all components, can be overridden individually |
| tls.nameOverride | string | `nil` | Name of external secret containing the TLS certificate and key |
| tls.enabled | bool | `false` | Enable or disable TLS for the server components (and ingress proxy) |
| tls.ingress.enabled | bool | `false` | Enable or disable TLS for the ingress proxy only |
Expand Down Expand Up @@ -158,6 +160,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| components.router.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| components.router.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| components.router.disableUI | bool | `false` | Disable the Grid UI |
| components.router.affinity | object | `{}` | Specify affinity for router pods, this overwrites global.seleniumGrid.affinity parameter |
| components.router.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for router pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| components.router.annotations | object | `{}` | Custom annotations for router pods |
| components.router.port | int | `4444` | Router container port |
| components.router.nodePort | int | `30444` | Router expose NodePort |
Expand All @@ -178,6 +182,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| components.distributor.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| components.distributor.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| 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 |
| components.distributor.affinity | object | `{}` | Specify affinity for distributor pods, this overwrites global.seleniumGrid.affinity parameter |
| components.distributor.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Distributor pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| components.distributor.annotations | object | `{}` | Custom annotations for Distributor pods |
| components.distributor.port | int | `5553` | Distributor container port |
| components.distributor.nodePort | int | `30553` | Distributor expose NodePort |
Expand All @@ -196,6 +202,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| components.eventBus.imageTag | string | `nil` | Event Bus image tag (this overwrites global.seleniumGrid.imageTag parameter) |
| components.eventBus.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| components.eventBus.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| components.eventBus.affinity | object | `{}` | Specify affinity for Event Bus pods, this overwrites global.seleniumGrid.affinity parameter |
| components.eventBus.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Event Bus pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| components.eventBus.annotations | object | `{}` | Custom annotations for Event Bus pods |
| components.eventBus.port | int | `5557` | Event Bus container port |
| components.eventBus.nodePort | int | `30557` | Event Bus expose NodePort |
Expand All @@ -215,6 +223,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| components.sessionMap.imageTag | string | `nil` | Session Map image tag (this overwrites global.seleniumGrid.imageTag parameter) |
| components.sessionMap.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| components.sessionMap.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| components.sessionMap.affinity | object | `{}` | Specify affinity for Session Map pods, this overwrites global.seleniumGrid.affinity parameter |
| components.sessionMap.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Session Map pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| components.sessionMap.annotations | object | `{}` | Custom annotations for Session Map pods |
| components.sessionMap.port | int | `5556` | Session Map container port |
| components.sessionMap.resources | object | `{}` | Resources for Session Map container |
Expand All @@ -229,6 +239,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| components.sessionQueue.imageTag | string | `nil` | Session Queue image tag (this overwrites global.seleniumGrid.imageTag parameter) |
| components.sessionQueue.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| components.sessionQueue.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| components.sessionQueue.affinity | object | `{}` | Specify affinity for Session Queue pods, this overwrites global.seleniumGrid.affinity parameter |
| components.sessionQueue.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Session Queue pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| components.sessionQueue.annotations | object | `{}` | Custom annotations for Session Queue pods |
| components.sessionQueue.port | int | `5559` | Session Queue container port |
| components.sessionQueue.nodePort | int | `30559` | Session Queue expose NodePort |
Expand All @@ -247,6 +259,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| hub.imageTag | string | `nil` | Selenium Hub image tag (this overwrites global.seleniumGrid.imageTag parameter) |
| hub.imagePullPolicy | string | `"IfNotPresent"` | Image pull policy (see https://kubernetes.io/docs/concepts/containers/images/#updating-images) |
| hub.imagePullSecret | string | `""` | Image pull secret (see https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) |
| hub.affinity | object | `{}` | Specify affinity for Selenium Hub pods, this overwrites global.seleniumGrid.affinity parameter |
| hub.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for Hub pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| hub.annotations | object | `{}` | Custom annotations for Selenium Hub pods |
| hub.labels | object | `{}` | Custom labels for Selenium Hub pods |
| hub.disableUI | bool | `false` | Disable the Grid UI |
Expand Down Expand Up @@ -313,6 +327,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| chromeNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
| chromeNode.port | int | `5555` | Node component port |
| chromeNode.nodePort | string | `nil` | Node component expose NodePort |
| chromeNode.affinity | object | `{}` | Specify affinity for chrome-node pods, this overwrites global.seleniumGrid.affinity parameter |
| chromeNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for chrome-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| chromeNode.annotations | object | `{}` | Annotations for chrome-node pods |
| chromeNode.labels | object | `{}` | Labels for chrome-node pods |
| chromeNode.shareProcessNamespace | bool | `true` | Shared process namespace for chrome-node pods |
Expand Down Expand Up @@ -361,6 +377,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| firefoxNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
| firefoxNode.port | int | `5555` | Node component port |
| firefoxNode.nodePort | string | `nil` | Node component expose NodePort |
| firefoxNode.affinity | object | `{}` | Specify affinity for firefox-node pods, this overwrites global.seleniumGrid.affinity parameter |
| firefoxNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for firefox-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| firefoxNode.annotations | object | `{}` | Annotations for firefox-node pods |
| firefoxNode.labels | object | `{}` | Labels for firefox-node pods |
| firefoxNode.tolerations | list | `[]` | Tolerations for firefox-node pods |
Expand Down Expand Up @@ -409,6 +427,8 @@ A Helm chart for creating a Selenium Grid Server in Kubernetes
| edgeNode.ports | list | `[]` | Extra ports list to enable on the node container (e.g. SSH, VNC, NoVNC, etc.) |
| edgeNode.port | int | `5555` | Node component port |
| edgeNode.nodePort | string | `nil` | Node component expose NodePort |
| edgeNode.affinity | object | `{}` | Specify affinity for edge-node pods, this overwrites global.seleniumGrid.affinity parameter |
| edgeNode.topologySpreadConstraints | list | `[]` | Specify topologySpreadConstraints for edge-node pods, this overwrites global.seleniumGrid.topologySpreadConstraints parameter |
| edgeNode.annotations | object | `{}` | Annotations for edge-node pods |
| edgeNode.labels | object | `{}` | Labels for edge-node pods |
| edgeNode.tolerations | list | `[]` | Tolerations for edge-node pods |
Expand Down
18 changes: 16 additions & 2 deletions charts/selenium-grid/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,22 @@ template:
{{- with .node.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 6 }}
{{- end }}
{{- with .node.affinity }}
affinity: {{- toYaml . | nindent 6 }}
{{- if or $.Values.global.seleniumGrid.affinity .node.affinity }}
{{- $affinityYaml := default $.Values.global.seleniumGrid.affinity .node.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 6 }}
{{- end }}
{{- if or $.Values.global.seleniumGrid.topologySpreadConstraints .node.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default $.Values.global.seleniumGrid.topologySpreadConstraints .node.topologySpreadConstraints }}
{{- $appName := .name }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ $appName }}
{{- end }}
{{- end }}
{{- end }}
{{- with .node.tolerations }}
tolerations:
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/distributor-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.components.distributor.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.distributor.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.distributor.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.components.distributor.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/event-bus-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.eventBus.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.eventBus.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.components.eventBus.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/hub-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.hub.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.hub.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.hub.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/router-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.router.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.router.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.components.router.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/session-map-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionMap.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.sessionMap.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.components.sessionMap.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
14 changes: 13 additions & 1 deletion charts/selenium-grid/templates/session-queue-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,19 @@ spec:
{{- if or .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
{{- $affinityYaml := default .Values.global.seleniumGrid.affinity .Values.components.sessionQueue.affinity }}
affinity: {{- toYaml $affinityYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if or .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
{{- $topologySpreadConstraints := default .Values.global.seleniumGrid.topologySpreadConstraints .Values.components.distributor.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := $topologySpreadConstraints }}
- {{ toYaml $constraint | nindent 10 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app: {{ template "seleniumGrid.sessionQueue.fullname" $ }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.components.sessionQueue.tolerations }}
tolerations: {{ toYaml . | nindent 6 }}
{{- end }}
Expand Down
Loading

0 comments on commit 4f2a6e4

Please sign in to comment.