1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 18:15:48 +00:00

fix: pod anti affinity (#5516)

* fix: pod antifinity

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2022-11-30 22:38:05 +01:00 committed by GitHub
parent 83b088ecb9
commit 1bf4455555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -32,17 +32,19 @@ spec:
{{- end }}
{{- if or .Values.antiAffinity.enable .Values.podAffinity .Values.nodeAffinity }}
affinity:
{{- if and .Values.antiAffinity.enable .Values.podAntiAffinity }}
{{- if .Values.antiAffinity.enable }}
{{- with .Values.podAntiAffinity }}
podAntiAffinity:
{{- toYaml .Values.podAntiAffinity | nindent 10 }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- if .Values.podAffinity }}
{{- end }}
{{- with .Values.podAffinity }}
podAffinity:
{{- toYaml .Values.podAffinity | nindent 10 }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- if .Values.nodeAffinity }}
{{- with .Values.nodeAffinity }}
nodeAffinity:
{{- toYaml .Values.nodeAffinity | nindent 10 }}
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}

View file

@ -128,10 +128,10 @@ podAntiAffinity:
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- kyverno
- key: app.kubernetes.io/name
operator: In
values:
- '{{ template "kyverno.name" . }}'
topologyKey: kubernetes.io/hostname
# -- Pod affinity constraints.