From efaf6269467019923faca46f6f0955eebe960f4f Mon Sep 17 00:00:00 2001 From: Yellow Shine Date: Mon, 23 Dec 2024 14:51:12 +0800 Subject: [PATCH] feat: support topologySpreadConstraints Signed-off-by: Yellow Shine --- .../templates/datacoord-deployment.yaml | 9 ++++++++ .../milvus/templates/datanode-deployment.yaml | 8 +++++++ .../templates/indexcoord-deployment.yaml | 9 ++++++++ .../templates/indexnode-deployment.yaml | 9 ++++++++ .../milvus/templates/mixcoord-deployment.yaml | 9 ++++++++ charts/milvus/templates/proxy-deployment.yaml | 9 ++++++++ .../templates/querycoord-deployment.yaml | 9 ++++++++ .../templates/querynode-deployment.yaml | 9 ++++++++ .../templates/rootcoord-deployment.yaml | 9 ++++++++ .../templates/standalone-deployment.yaml | 8 +++++++ .../templates/streamingnode-deployment.yaml | 8 +++++++ charts/milvus/values.yaml | 22 +++++++++++++++++++ 12 files changed, 118 insertions(+) diff --git a/charts/milvus/templates/datacoord-deployment.yaml b/charts/milvus/templates/datacoord-deployment.yaml index b022e78..b5024bf 100644 --- a/charts/milvus/templates/datacoord-deployment.yaml +++ b/charts/milvus/templates/datacoord-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/datanode-deployment.yaml b/charts/milvus/templates/datanode-deployment.yaml index 11ec00a..4a9f880 100644 --- a/charts/milvus/templates/datanode-deployment.yaml +++ b/charts/milvus/templates/datanode-deployment.yaml @@ -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 diff --git a/charts/milvus/templates/indexcoord-deployment.yaml b/charts/milvus/templates/indexcoord-deployment.yaml index f6e85c6..2cbd98f 100644 --- a/charts/milvus/templates/indexcoord-deployment.yaml +++ b/charts/milvus/templates/indexcoord-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/indexnode-deployment.yaml b/charts/milvus/templates/indexnode-deployment.yaml index f4eadc9..f372d01 100644 --- a/charts/milvus/templates/indexnode-deployment.yaml +++ b/charts/milvus/templates/indexnode-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/mixcoord-deployment.yaml b/charts/milvus/templates/mixcoord-deployment.yaml index a20f1b3..f8c94d3 100644 --- a/charts/milvus/templates/mixcoord-deployment.yaml +++ b/charts/milvus/templates/mixcoord-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/proxy-deployment.yaml b/charts/milvus/templates/proxy-deployment.yaml index 1d482cf..bd088c0 100644 --- a/charts/milvus/templates/proxy-deployment.yaml +++ b/charts/milvus/templates/proxy-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/querycoord-deployment.yaml b/charts/milvus/templates/querycoord-deployment.yaml index 7d74831..e20e590 100644 --- a/charts/milvus/templates/querycoord-deployment.yaml +++ b/charts/milvus/templates/querycoord-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/querynode-deployment.yaml b/charts/milvus/templates/querynode-deployment.yaml index 74052b5..d2719ae 100644 --- a/charts/milvus/templates/querynode-deployment.yaml +++ b/charts/milvus/templates/querynode-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/rootcoord-deployment.yaml b/charts/milvus/templates/rootcoord-deployment.yaml index b68d64c..c52156e 100644 --- a/charts/milvus/templates/rootcoord-deployment.yaml +++ b/charts/milvus/templates/rootcoord-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/standalone-deployment.yaml b/charts/milvus/templates/standalone-deployment.yaml index fdb187d..03bb5d3 100644 --- a/charts/milvus/templates/standalone-deployment.yaml +++ b/charts/milvus/templates/standalone-deployment.yaml @@ -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: diff --git a/charts/milvus/templates/streamingnode-deployment.yaml b/charts/milvus/templates/streamingnode-deployment.yaml index fe2c634..a323b9f 100644 --- a/charts/milvus/templates/streamingnode-deployment.yaml +++ b/charts/milvus/templates/streamingnode-deployment.yaml @@ -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 diff --git a/charts/milvus/values.yaml b/charts/milvus/values.yaml index c69cd10..cd83c05 100644 --- a/charts/milvus/values.yaml +++ b/charts/milvus/values.yaml @@ -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: {} @@ -216,6 +228,7 @@ standalone: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -258,6 +271,7 @@ proxy: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -296,6 +310,7 @@ rootCoordinator: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -322,6 +337,7 @@ queryCoordinator: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -352,6 +368,7 @@ queryNode: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -374,6 +391,7 @@ indexCoordinator: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -403,6 +421,7 @@ indexNode: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -425,6 +444,7 @@ dataCoordinator: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -451,6 +471,7 @@ dataNode: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false @@ -471,6 +492,7 @@ mixCoordinator: nodeSelector: {} affinity: {} tolerations: [] + topologySpreadConstraints: [] # Component specific topologySpreadConstraints extraEnv: [] heaptrack: enabled: false