diff --git a/ansible/roles/antivirus_check_service/templates/scanfile-deployment.yml.j2 b/ansible/roles/antivirus_check_service/templates/scanfile-deployment.yml.j2 index ec2496f..307a2cc 100644 --- a/ansible/roles/antivirus_check_service/templates/scanfile-deployment.yml.j2 +++ b/ansible/roles/antivirus_check_service/templates/scanfile-deployment.yml.j2 @@ -66,6 +66,7 @@ spec: volumes: - name: shared emptyDir: {} +{% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %} affinity: podAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -101,3 +102,4 @@ spec: values: - scanfile topologyKey: "topology.kubernetes.io/zone" +{% endif %} diff --git a/ansible/roles/antivirus_check_service/templates/web-deployment.yml.j2 b/ansible/roles/antivirus_check_service/templates/web-deployment.yml.j2 index dcfcc0d..421f8e9 100644 --- a/ansible/roles/antivirus_check_service/templates/web-deployment.yml.j2 +++ b/ansible/roles/antivirus_check_service/templates/web-deployment.yml.j2 @@ -63,6 +63,7 @@ spec: requests: cpu: {{ ANTIVIRUS_WEBSERVER_CPU_REQUESTS|default("100m", true) }} memory: {{ ANTIVIRUS_WEBSERVER_MEMORY_REQUESTS|default("128Mi", true) }} +{% if AFFINITY_ENABLE is defined and AFFINITY_ENABLE|bool %} affinity: podAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -98,3 +99,4 @@ spec: values: - webserver topologyKey: "topology.kubernetes.io/zone" +{% endif %}