From 03027f15fc77cf540593e50ef9263a9e1f9c4077 Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Thu, 30 Jun 2022 09:28:08 -0300 Subject: [PATCH] Implement podAntiAffinity for nginx --- .../v0.1.0/templates/nginx-deployment.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml index c344891..8257698 100644 --- a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml @@ -64,10 +64,20 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} affinity: - {{- toYaml . | nindent 8 }} - {{- end }} + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - {{ include "mailproxy.name" . }} + - key: app.kubernetes.io/instance + operator: In + values: + - {{ .Release.Name }} + topologyKey: "kubernetes.io/hostname" {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }}