Skip to content

Commit

Permalink
Adds default selectorLabels if not otherwise specified.
Browse files Browse the repository at this point in the history
If someone defines one or more entries in the
`topologySpreadConstraints` list and does not define the
`labelSelectors.matchLabels` keys then default values will be added.
Most people are likely going to want the default selectorLabels so the
spread constraints match what they are deploying with this chart.
  • Loading branch information
bderrly committed Nov 26, 2024
1 parent 2bfa1fc commit 383037f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/vector/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ tolerations:
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $_, $entry := . }}
{{- if not (dig "labelSelectors" "matchLabels" false $entry) }}
{{- $ls := "labelSelectors:\n matchLabels: {}" | fromYaml }}
{{- $_ := set $ls.labelSelectors "matchLabels" (include "vector.selectorLabels" $ | fromYaml) }}
{{- $entry := merge $entry $ls }}
{{- end }}
{{- end }}
{{- toYaml . | nindent 2 }}
{{- end }}
volumes:
Expand Down
2 changes: 2 additions & 0 deletions charts/vector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 there are no "selectorLabels.matchLabels" are defined then defaults will be used to match the selectorLabels of this instance.
topologySpreadConstraints: []

# Configuration for Vector's Service.
Expand Down

0 comments on commit 383037f

Please sign in to comment.