diff --git a/ansible/roles/schulcloud-client-core/templates/deployment.yml.j2 b/ansible/roles/schulcloud-client-core/templates/deployment.yml.j2 index d4a237bbad..f5dea5ec51 100644 --- a/ansible/roles/schulcloud-client-core/templates/deployment.yml.j2 +++ b/ansible/roles/schulcloud-client-core/templates/deployment.yml.j2 @@ -87,6 +87,39 @@ spec: requests: cpu: {{ CLIENT_CPU_REQUESTS|default("100m", true) }} memory: {{ CLIENT_MEMORY_REQUESTS|default("128Mi", true) }} + affinity: + podAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/part-of + operator: In + values: + - schulcloud-verbund + topologyKey: "kubernetes.io/hostname" + namespaceSelector: {} + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 10 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - client + topologyKey: "cloud.ionos.com/nodepool-name" + - weight: 10 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - client + topologyKey: "topology.kubernetes.io/zone" volumes: - name: http-headers configMap: