Skip to content

Commit

Permalink
feat: support topologySpreadConstraints (#167)
Browse files Browse the repository at this point in the history
Signed-off-by: Yellow Shine <[email protected]>
  • Loading branch information
yellow-shine authored Dec 24, 2024
1 parent 20c2dfb commit 2f452bc
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charts/milvus/templates/datacoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ spec:
{{- if .Values.dataCoordinator.tolerations }}
tolerations:
{{ toYaml .Values.dataCoordinator.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.dataCoordinator.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.dataCoordinator.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.dataCoordinator.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
8 changes: 8 additions & 0 deletions charts/milvus/templates/datanode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ spec:
{{- if .Values.dataNode.tolerations }}
tolerations:
{{ toYaml .Values.dataNode.tolerations | indent 8 }}
{{- end }}
{{- if and (.Values.topologySpreadConstraints) (not .Values.dataNode.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.dataNode.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.dataNode.topologySpreadConstraints | indent 8 }}
{{- end }}
volumes:
- name: milvus-config
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/indexcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ spec:
{{- if .Values.indexCoordinator.tolerations }}
tolerations:
{{ toYaml .Values.indexCoordinator.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.indexCoordinator.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.indexCoordinator.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.indexCoordinator.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/indexnode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ spec:
{{- if .Values.indexNode.tolerations }}
tolerations:
{{ toYaml .Values.indexNode.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.indexNode.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.indexNode.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.indexNode.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/mixcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ spec:
{{- if .Values.mixCoordinator.tolerations }}
tolerations:
{{ toYaml .Values.mixCoordinator.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.mixCoordinator.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.mixCoordinator.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.mixCoordinator.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ spec:
{{- if .Values.proxy.tolerations }}
tolerations:
{{ toYaml .Values.proxy.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.proxy.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.proxy.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.proxy.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/querycoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ spec:
{{- if .Values.queryCoordinator.tolerations }}
tolerations:
{{ toYaml .Values.queryCoordinator.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.queryCoordinator.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.queryCoordinator.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.queryCoordinator.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/querynode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ spec:
{{- if .Values.queryNode.tolerations }}
tolerations:
{{ toYaml .Values.queryNode.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.queryNode.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.queryNode.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.queryNode.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
9 changes: 9 additions & 0 deletions charts/milvus/templates/rootcoord-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ spec:
{{- if .Values.rootCoordinator.tolerations }}
tolerations:
{{ toYaml .Values.rootCoordinator.tolerations | indent 8 }}
{{- end }}

{{- if and (.Values.topologySpreadConstraints) (not .Values.rootCoordinator.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.rootCoordinator.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.rootCoordinator.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
8 changes: 8 additions & 0 deletions charts/milvus/templates/standalone-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ spec:
{{- if .Values.standalone.tolerations }}
tolerations:
{{ toYaml .Values.standalone.tolerations | indent 8 }}
{{- end }}
{{- if and (.Values.topologySpreadConstraints) (not .Values.standalone.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.standalone.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.standalone.topologySpreadConstraints | indent 8 }}
{{- end }}

volumes:
Expand Down
8 changes: 8 additions & 0 deletions charts/milvus/templates/streamingnode-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ spec:
{{- if .Values.streamingNode.tolerations }}
tolerations:
{{ toYaml .Values.streamingNode.tolerations | indent 8 }}
{{- end }}
{{- if and (.Values.topologySpreadConstraints) (not .Values.streamingNode.topologySpreadConstraints) }}
topologySpreadConstraints:
{{ toYaml .Values.topologySpreadConstraints | indent 8 }}
{{- end }}
{{- if .Values.streamingNode.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.streamingNode.topologySpreadConstraints | indent 8 }}
{{- end }}
volumes:
- name: milvus-config
Expand Down
22 changes: 22 additions & 0 deletions charts/milvus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ tolerations: []
# Individual components can be set to a different affinity
affinity: {}

# Global topologySpreadConstraints
# If set, this will apply to all milvus components
# Individual components can be set to different topologySpreadConstraints
# ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: milvus

# Global labels and annotations
# If set, this will apply to all milvus components
labels: {}
Expand Down Expand Up @@ -216,6 +228,7 @@ standalone:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand Down Expand Up @@ -258,6 +271,7 @@ proxy:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand Down Expand Up @@ -296,6 +310,7 @@ rootCoordinator:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand All @@ -322,6 +337,7 @@ queryCoordinator:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand Down Expand Up @@ -352,6 +368,7 @@ queryNode:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand All @@ -374,6 +391,7 @@ indexCoordinator:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand Down Expand Up @@ -403,6 +421,7 @@ indexNode:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand All @@ -425,6 +444,7 @@ dataCoordinator:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand All @@ -451,6 +471,7 @@ dataNode:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand All @@ -471,6 +492,7 @@ mixCoordinator:
nodeSelector: {}
affinity: {}
tolerations: []
topologySpreadConstraints: [] # Component specific topologySpreadConstraints
extraEnv: []
heaptrack:
enabled: false
Expand Down

0 comments on commit 2f452bc

Please sign in to comment.