Skip to content

Commit 2856eba

Browse files
tadehanineinchnick
authored andcommitted
Add topologySpreadConstraints to worker deployment
1 parent 186e7c7 commit 2856eba

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

charts/trino/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,27 @@ Fast distributed SQL query engine for big data analytics that helps you explore
712712
* `worker.nodeSelector` - object, default: `{}`
713713
* `worker.tolerations` - list, default: `[]`
714714
* `worker.affinity` - object, default: `{}`
715+
* `worker.topologySpreadConstraints` - list, default: `[]`
716+
717+
Configure [topology spread constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) to control how worker pods are spread across your cluster among failure-domains such as nodes, zones, and regions. This is a best practice for achieving high availability and preventing resource hotspots.
718+
Example of spreading workers across hostnames and zones:
719+
```yaml
720+
topologySpreadConstraints:
721+
- maxSkew: 1
722+
topologyKey: "kubernetes.io/hostname"
723+
whenUnsatisfiable: "ScheduleAnyway"
724+
labelSelector:
725+
matchLabels:
726+
app.kubernetes.io/name: trino
727+
app.kubernetes.io/component: worker
728+
- maxSkew: 1
729+
topologyKey: "topology.kubernetes.io/zone"
730+
whenUnsatisfiable: "DoNotSchedule"
731+
labelSelector:
732+
matchLabels:
733+
app.kubernetes.io/name: trino
734+
app.kubernetes.io/component: worker
735+
```
715736
* `worker.additionalConfigFiles` - object, default: `{}`
716737

717738
Additional config files placed in the default configuration directory. Supports templating the files' contents with `tpl`.

charts/trino/templates/deployment-worker.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ spec:
256256
nodeSelector:
257257
{{- toYaml . | nindent 8 }}
258258
{{- end }}
259+
{{- with .Values.worker.topologySpreadConstraints }}
260+
topologySpreadConstraints:
261+
{{- toYaml . | nindent 8 }}
262+
{{- end }}
259263
{{- with .Values.worker.affinity }}
260264
affinity:
261265
{{- toYaml . | nindent 8 }}

charts/trino/values.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,33 @@ worker:
862862

863863
affinity: {}
864864

865+
topologySpreadConstraints: []
866+
# worker.topologySpreadConstraints -- Configure [topology spread
867+
# constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/)
868+
# to control how worker pods are spread across your cluster among failure-domains
869+
# such as nodes, zones, and regions. This is a best practice for achieving high
870+
# availability and preventing resource hotspots.
871+
#
872+
# @raw
873+
# Example of spreading workers across hostnames and zones:
874+
# ```yaml
875+
# topologySpreadConstraints:
876+
# - maxSkew: 1
877+
# topologyKey: "kubernetes.io/hostname"
878+
# whenUnsatisfiable: "ScheduleAnyway"
879+
# labelSelector:
880+
# matchLabels:
881+
# app.kubernetes.io/name: trino
882+
# app.kubernetes.io/component: worker
883+
# - maxSkew: 1
884+
# topologyKey: "topology.kubernetes.io/zone"
885+
# whenUnsatisfiable: "DoNotSchedule"
886+
# labelSelector:
887+
# matchLabels:
888+
# app.kubernetes.io/name: trino
889+
# app.kubernetes.io/component: worker
890+
# ```
891+
865892
additionalConfigFiles: {}
866893
# worker.additionalConfigFiles -- Additional config files placed in the default configuration directory.
867894
# Supports templating the files' contents with `tpl`.

tests/trino/test-values.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,22 @@ worker:
137137
annotations:
138138
custom/name: value
139139

140+
topologySpreadConstraints:
141+
- maxSkew: 1
142+
topologyKey: "kubernetes.io/hostname"
143+
whenUnsatisfiable: "ScheduleAnyway"
144+
labelSelector:
145+
matchLabels:
146+
app.kubernetes.io/name: trino
147+
app.kubernetes.io/component: worker
148+
- maxSkew: 1
149+
topologyKey: "topology.kubernetes.io/zone"
150+
whenUnsatisfiable: "ScheduleAnyway"
151+
labelSelector:
152+
matchLabels:
153+
app.kubernetes.io/name: trino
154+
app.kubernetes.io/component: worker
155+
140156
commonLabels:
141157
extra-label: extra-value
142158

0 commit comments

Comments
 (0)