diff --git a/charts/vector/templates/_pod.tpl b/charts/vector/templates/_pod.tpl index 2090e7f..c215af0 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 "labelSelectors" "matchLabels" false $entry) }} + {{- $ls := dict -}} + {{- $_ := set $ls "labelSelectors" dict -}} + {{- $_ := set $ls.labelSelectors "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 2deeb3e..9ceded2 100644 --- a/charts/vector/values.yaml +++ b/charts/vector/values.yaml @@ -232,6 +232,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.