Skip to content

Commit

Permalink
add support for topologyspreadconstraints
Browse files Browse the repository at this point in the history
  • Loading branch information
velotioaastha committed Dec 3, 2024
1 parent 4103c08 commit d05cdf8
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/operator-wandb/charts/app/templates/_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ spec:
{{- include "wandb.nodeSelector" . | nindent 6 }}
{{- include "wandb.priorityClassName" . | nindent 6 }}
{{- include "wandb.podSecurityContext" .Values.pod.securityContext | nindent 6 }}
{{- if .Values.topologySpreadConstraints.enabled }}
{{- include "wandb.topologySpreadConstraints" (dict "matchLabels" (fromYaml (include "app.labels" .))) | nindent 6 }}
{{- end }}
terminationGracePeriodSeconds: 60
initContainers:
- name: init-db
Expand Down
3 changes: 3 additions & 0 deletions charts/operator-wandb/charts/app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ container:
readOnlyRootFilesystem: false
privileged: false

topologySpreadConstraints:
enabled: false

common:
labels: {}

Expand Down
24 changes: 24 additions & 0 deletions charts/operator-wandb/templates/_pods.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,27 @@ securityContext:
{{- end }}
{{- end }}

{{/*
Return a simplified topologySpreadConstraints definition with dynamic labelSelector and matchLabels passed as a map.
*/}}
{{- define "wandb.topologySpreadConstraints" -}}
{{- $matchLabels := .matchLabels -}}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
{{- range $key, $value := $matchLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
{{- range $key, $value := $matchLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}

27 changes: 27 additions & 0 deletions charts/operator-wandb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,16 @@ parquet:
image:
repository: wandb/local
tag: latest
topologySpreadConstraints:
enabled: false

app:
install: true
image:
repository: wandb/local
tag: latest
topologySpreadConstraints:
enabled: false

nginx:
install: false
Expand All @@ -219,6 +223,8 @@ weave:
image:
repository: wandb/local
tag: latest
topologySpreadConstraints:
enabled: false

weave-trace:
install: false
Expand All @@ -227,12 +233,16 @@ weave-trace:
tag: latest
datadog:
enabled: false
topologySpreadConstraints:
enabled: false

console:
install: true
image:
repository: wandb/console
tag: latest
topologySpreadConstraints:
enabled: false

flat-run-fields-updater:
install: false
Expand All @@ -241,6 +251,8 @@ flat-run-fields-updater:
tag: latest
pubSub:
subscription: ""
topologySpreadConstraints:
enabled: false

filestream:
install: false
Expand All @@ -249,18 +261,24 @@ filestream:
tag: 0.63.0-danielpanzella-filestream-local.1
pubSub:
subscription: ""
topologySpreadConstraints:
enabled: false

executor:
install: false
image:
repository: wandb/local
tag: latest
topologySpreadConstraints:
enabled: false

mysql:
install: false
persistence:
size: 20Gi
storageClass: ""
topologySpreadConstraints:
enabled: false

yace:
install: false
Expand All @@ -271,6 +289,8 @@ yace:
prometheus.io/port: "5000"
prometheus.io/path: "/metrics"
prometheus.io/scheme: http
topologySpreadConstraints:
enabled: false

redis:
install: true
Expand Down Expand Up @@ -298,6 +318,9 @@ prometheus:
mysql-exporter:
install: true

topologySpreadConstraints:
enabled: false

stackdriver:
install: false
pod:
Expand All @@ -306,9 +329,13 @@ stackdriver:
prometheus.io/port: "9255"
prometheus.io/path: "/metrics"
prometheus.io/scheme: http
topologySpreadConstraints:
enabled: false

otel:
install: true
topologySpreadConstraints:
enabled: false

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

0 comments on commit d05cdf8

Please sign in to comment.