Skip to content

Commit 5ec1982

Browse files
committed
feat: add topologySpreadConstraints
Signed-off-by: fe80 <steffyfort@gmail.com>
1 parent d405b96 commit 5ec1982

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed

charts/mageai/templates/deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ spec:
139139
tolerations:
140140
{{- toYaml . | nindent 8 }}
141141
{{- end }}
142+
{{- with .Values.topologySpreadConstraints }}
143+
topologySpreadConstraints:
144+
{{- range $constraint := . }}
145+
- {{ toYaml $constraint | nindent 10 | trim }}
146+
{{- if not $constraint.labelSelector }}
147+
labelSelector:
148+
matchLabels:
149+
{{- include "mageai.selectorLabels" $ | nindent 14 }}
150+
{{- end }}
151+
{{- end }}
152+
{{- end }}
142153
volumes:
143154
{{- if .Values.volumes }}
144155
{{- toYaml .Values.volumes | nindent 8 }}

charts/mageai/templates/scheduler.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ spec:
110110
tolerations:
111111
{{- toYaml . | nindent 8 }}
112112
{{- end }}
113+
{{- with .Values.scheduler.topologySpreadConstraints }}
114+
topologySpreadConstraints:
115+
{{- range $constraint := . }}
116+
- {{ toYaml $constraint | nindent 10 | trim }}
117+
{{- if not $constraint.labelSelector }}
118+
labelSelector:
119+
matchLabels:
120+
{{- include "mageai.schedulerSelectorLabels" $ | nindent 14 }}
121+
{{- end }}
122+
{{- end }}
123+
{{- end }}
113124
volumes:
114125
{{- if .Values.volumes }}
115126
{{- toYaml .Values.volumes | nindent 8 }}

charts/mageai/templates/webservice.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ spec:
138138
tolerations:
139139
{{- toYaml . | nindent 8 }}
140140
{{- end }}
141+
{{- with .Values.webServer.topologySpreadConstraints }}
142+
topologySpreadConstraints:
143+
{{- range $constraint := . }}
144+
- {{ toYaml $constraint | nindent 10 | trim }}
145+
{{- if not $constraint.labelSelector }}
146+
labelSelector:
147+
matchLabels:
148+
{{- include "mageai.selectorLabels" $ | nindent 14 }}
149+
{{- end }}
150+
{{- end }}
151+
{{- end }}
141152
volumes:
142153
{{- if .Values.volumes }}
143154
{{- toYaml .Values.volumes | nindent 8 }}

charts/mageai/values.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ scheduler:
2525
# maxReplicas: 10
2626
# targetCPUUtilizationPercentage: 50
2727

28+
topologySpreadConstraints: []
29+
# - maxSkew: 1
30+
# topologyKey: topology.kubernetes.io/zone
31+
# whenUnsatisfiable: ScheduleAnyway
32+
# matchLabelKeys:
33+
# - pod-template-hash
34+
# - maxSkew: 1
35+
# topologyKey: kubernetes.io/hostname
36+
# whenUnsatisfiable: DoNotSchedule
37+
# matchLabelKeys:
38+
# - pod-template-hash
39+
2840
# Effective if standaloneScheduler is true
2941
webServer:
3042
replicaCount: 1
@@ -44,6 +56,17 @@ webServer:
4456
# minReplicas: 1
4557
# maxReplicas: 10
4658
# targetCPUUtilizationPercentage: 50
59+
topologySpreadConstraints: []
60+
# - maxSkew: 1
61+
# topologyKey: topology.kubernetes.io/zone
62+
# whenUnsatisfiable: ScheduleAnyway
63+
# matchLabelKeys:
64+
# - pod-template-hash
65+
# - maxSkew: 1
66+
# topologyKey: kubernetes.io/hostname
67+
# whenUnsatisfiable: DoNotSchedule
68+
# matchLabelKeys:
69+
# - pod-template-hash
4770

4871
# Enable Postgres as the DB
4972
postgresql:
@@ -174,6 +197,18 @@ nodeSelector: {}
174197

175198
tolerations: []
176199

200+
topologySpreadConstraints:
201+
- maxSkew: 1
202+
topologyKey: topology.kubernetes.io/zone
203+
whenUnsatisfiable: ScheduleAnyway
204+
matchLabelKeys:
205+
- pod-template-hash
206+
- maxSkew: 1
207+
topologyKey: kubernetes.io/hostname
208+
whenUnsatisfiable: DoNotSchedule
209+
matchLabelKeys:
210+
- pod-template-hash
211+
177212
affinity: {}
178213

179214
extraVolumeMounts:

0 commit comments

Comments
 (0)