From 5a29a7f9b05615317d9d0323db77b37d04fdf823 Mon Sep 17 00:00:00 2001 From: Christian Rohmann Date: Thu, 20 Feb 2025 18:36:26 +0100 Subject: [PATCH] Allow configuration of topologySpreadConstraints for flagger deployment Resolves: #1765 --- charts/flagger/templates/deployment.yaml | 6 +++++- charts/flagger/values.yaml | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/charts/flagger/templates/deployment.yaml b/charts/flagger/templates/deployment.yaml index ee7d22b50..112d526c7 100644 --- a/charts/flagger/templates/deployment.yaml +++ b/charts/flagger/templates/deployment.yaml @@ -49,6 +49,10 @@ spec: affinity: {{- tpl (toYaml .Values.affinity) . | nindent 8 }} {{- end }} + {{- if .Values.topologySpreadConstraints }} + topologySpreadConstraints: + {{- tpl (toYaml .Values.topologySpreadConstraints) . | nindent 8 }} + {{- end }} {{- if .Values.image.pullSecret }} imagePullSecrets: - name: {{ .Values.image.pullSecret }} @@ -64,7 +68,7 @@ spec: {{- end }} {{- if .Values.podPriorityClassName }} priorityClassName: {{ .Values.podPriorityClassName }} - {{- end }} + {{- end }} containers: - name: flagger {{- if .Values.securityContext.enabled }} diff --git a/charts/flagger/values.yaml b/charts/flagger/values.yaml index a619c0026..9e8ff753f 100644 --- a/charts/flagger/values.yaml +++ b/charts/flagger/values.yaml @@ -167,6 +167,19 @@ affinity: app.kubernetes.io/instance: '{{ .Release.Name }}' topologyKey: kubernetes.io/hostname +topologySpreadConstraints: + - labelSelector: + matchLabels: + app.kubernetes.io/name: '{{ template "flagger.name" . }}' + app.kubernetes.io/instance: '{{ .Release.Name }}' + matchLabelKeys: + - pod-template-hash + topologyKey: topology.kubernetes.io/zone + maxSkew: 1 + whenUnsatisfiable: ScheduleAnyway + + + prometheus: # to be used with ingress controllers install: false