Skip to content

Commit c690bdd

Browse files
committed
Add values to configure topologySpreadConstraints of controller Deployment
1 parent 8f8eedb commit c690bdd

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

chart/templates/_helpers.tpl

+14
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,17 @@ clientCache numLocks
345345
{{- end -}}
346346
{{- end -}}
347347
{{- end -}}
348+
349+
{{/*
350+
topologySpreadConstraints appends the "vso.chart.selectorLabels" to .Values.controller.topologySpreadConstraints if no labelSelector was specified
351+
*/}}
352+
{{- define "vso.topologySpreadConstraints" -}}
353+
{{- $defaultLabelSelector := dict "labelSelector" (dict "matchLabels" (include "vso.chart.selectorLabels" . | fromYaml)) -}}
354+
{{- range $topologySpreadConstraint := .Values.controller.topologySpreadConstraints -}}
355+
{{- if hasKey $topologySpreadConstraint "labelSelector" -}}
356+
{{- $topologySpreadConstraint | list | toYaml -}}
357+
{{- else -}}
358+
{{- merge $topologySpreadConstraint $defaultLabelSelector | list | toYaml -}}
359+
{{- end -}}
360+
{{- end -}}
361+
{{- end -}}

chart/templates/deployment.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ spec:
155155
affinity:
156156
{{- toYaml .Values.controller.affinity | nindent 8 }}
157157
{{- end }}
158+
{{- if .Values.controller.topologySpreadConstraints }}
159+
topologySpreadConstraints:
160+
{{- include "vso.topologySpreadConstraints" . | nindent 8 }}
161+
{{- end }}
158162
volumes:
159163
- downwardAPI:
160164
items:

chart/values.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ controller:
6666
# - antarctica-west1
6767
affinity: {}
6868

69+
# TopologySpreadConstraints settings for vault-secrets-operator pod.
70+
# The value is an array of PodSpec TopologySpreadConstraint maps.
71+
# A labelSelector for the pods will be added automatically to the template in case it is not set.
72+
# ref: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
73+
# Example:
74+
# topologySpreadConstraints:
75+
# - maxSkew: 1
76+
# topologyKey: zone
77+
# whenUnsatisfiable: DoNotSchedule
78+
topologySpreadConstraints: []
79+
6980
# Configure the PodDisruptionBudget for the controller deployment.
7081
podDisruptionBudget:
7182

0 commit comments

Comments
 (0)