diff --git a/charts/vector/templates/_pod.tpl b/charts/vector/templates/_pod.tpl index 7ae1cfd6..89a98d61 100644 --- a/charts/vector/templates/_pod.tpl +++ b/charts/vector/templates/_pod.tpl @@ -174,6 +174,14 @@ tolerations: {{- end }} {{- with .Values.topologySpreadConstraints }} topologySpreadConstraints: +{{- range $_, $entry := . }} +{{- if not (dig "labelSelector" "matchLabels" false $entry) }} + {{- $ls := dict -}} + {{- $_ := set $ls "labelSelector" dict -}} + {{- $_ := set $ls.labelSelector "matchLabels" (include "vector.selectorLabels" $ | fromYaml) }} + {{- $entry := merge $entry $ls }} +{{- end }} +{{- end }} {{- toYaml . | nindent 2 }} {{- end }} volumes: diff --git a/charts/vector/values.yaml b/charts/vector/values.yaml index 54c8a3b6..df29221e 100644 --- a/charts/vector/values.yaml +++ b/charts/vector/values.yaml @@ -238,6 +238,8 @@ affinity: {} # topologySpreadConstraints -- Configure [topology spread constraints](https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/) # for Vector Pods. Valid for the "Aggregator" and "Stateless-Aggregator" roles. +# +# If no "selectorLabels.matchLabels" are defined then defaults will be used to match the selectorLabels of this instance. topologySpreadConstraints: [] # Configuration for Vector's Service.