Skip to content

Commit d05cdf8

Browse files
committed
add support for topologyspreadconstraints
1 parent 4103c08 commit d05cdf8

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

Diff for: charts/operator-wandb/charts/app/templates/_deployment.tpl

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ spec:
4545
{{- include "wandb.nodeSelector" . | nindent 6 }}
4646
{{- include "wandb.priorityClassName" . | nindent 6 }}
4747
{{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
48+
{{- if .Values.topologySpreadConstraints.enabled }}
49+
{{- include "wandb.topologySpreadConstraints" (dict "matchLabels" (fromYaml (include "app.labels" .))) | nindent 6 }}
50+
{{- end }}
4851
terminationGracePeriodSeconds: 60
4952
initContainers:
5053
- name: init-db

Diff for: charts/operator-wandb/charts/app/values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ container:
4949
readOnlyRootFilesystem: false
5050
privileged: false
5151

52+
topologySpreadConstraints:
53+
enabled: false
54+
5255
common:
5356
labels: {}
5457

Diff for: charts/operator-wandb/templates/_pods.tpl

+24
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,27 @@ securityContext:
8888
{{- end }}
8989
{{- end }}
9090

91+
{{/*
92+
Return a simplified topologySpreadConstraints definition with dynamic labelSelector and matchLabels passed as a map.
93+
*/}}
94+
{{- define "wandb.topologySpreadConstraints" -}}
95+
{{- $matchLabels := .matchLabels -}}
96+
topologySpreadConstraints:
97+
- maxSkew: 1
98+
topologyKey: kubernetes.io/hostname
99+
whenUnsatisfiable: ScheduleAnyway
100+
labelSelector:
101+
matchLabels:
102+
{{- range $key, $value := $matchLabels }}
103+
{{ $key }}: {{ $value | quote }}
104+
{{- end }}
105+
- maxSkew: 1
106+
topologyKey: topology.kubernetes.io/zone
107+
whenUnsatisfiable: ScheduleAnyway
108+
labelSelector:
109+
matchLabels:
110+
{{- range $key, $value := $matchLabels }}
111+
{{ $key }}: {{ $value | quote }}
112+
{{- end }}
113+
{{- end }}
114+

Diff for: charts/operator-wandb/values.yaml

+27
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,16 @@ parquet:
204204
image:
205205
repository: wandb/local
206206
tag: latest
207+
topologySpreadConstraints:
208+
enabled: false
207209

208210
app:
209211
install: true
210212
image:
211213
repository: wandb/local
212214
tag: latest
215+
topologySpreadConstraints:
216+
enabled: false
213217

214218
nginx:
215219
install: false
@@ -219,6 +223,8 @@ weave:
219223
image:
220224
repository: wandb/local
221225
tag: latest
226+
topologySpreadConstraints:
227+
enabled: false
222228

223229
weave-trace:
224230
install: false
@@ -227,12 +233,16 @@ weave-trace:
227233
tag: latest
228234
datadog:
229235
enabled: false
236+
topologySpreadConstraints:
237+
enabled: false
230238

231239
console:
232240
install: true
233241
image:
234242
repository: wandb/console
235243
tag: latest
244+
topologySpreadConstraints:
245+
enabled: false
236246

237247
flat-run-fields-updater:
238248
install: false
@@ -241,6 +251,8 @@ flat-run-fields-updater:
241251
tag: latest
242252
pubSub:
243253
subscription: ""
254+
topologySpreadConstraints:
255+
enabled: false
244256

245257
filestream:
246258
install: false
@@ -249,18 +261,24 @@ filestream:
249261
tag: 0.63.0-danielpanzella-filestream-local.1
250262
pubSub:
251263
subscription: ""
264+
topologySpreadConstraints:
265+
enabled: false
252266

253267
executor:
254268
install: false
255269
image:
256270
repository: wandb/local
257271
tag: latest
272+
topologySpreadConstraints:
273+
enabled: false
258274

259275
mysql:
260276
install: false
261277
persistence:
262278
size: 20Gi
263279
storageClass: ""
280+
topologySpreadConstraints:
281+
enabled: false
264282

265283
yace:
266284
install: false
@@ -271,6 +289,8 @@ yace:
271289
prometheus.io/port: "5000"
272290
prometheus.io/path: "/metrics"
273291
prometheus.io/scheme: http
292+
topologySpreadConstraints:
293+
enabled: false
274294

275295
redis:
276296
install: true
@@ -298,6 +318,9 @@ prometheus:
298318
mysql-exporter:
299319
install: true
300320

321+
topologySpreadConstraints:
322+
enabled: false
323+
301324
stackdriver:
302325
install: false
303326
pod:
@@ -306,9 +329,13 @@ stackdriver:
306329
prometheus.io/port: "9255"
307330
prometheus.io/path: "/metrics"
308331
prometheus.io/scheme: http
332+
topologySpreadConstraints:
333+
enabled: false
309334

310335
otel:
311336
install: true
337+
topologySpreadConstraints:
338+
enabled: false
312339

313340
# Consider deploying with a deployment rather than a daemonset to avoid
314341
# redundant metrics. In setups where both are scraping the same endpoints,

0 commit comments

Comments
 (0)