From b91400fd9210d9bd46e665e764ec82547e1a7924 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Fri, 27 May 2022 11:21:57 +0200 Subject: [PATCH] templates/composer: Add podAntiAffinity rule based on hostname Linter output: Specify anti-affinity in your pod specification to ensure that the orchestrator attempts to schedule replicas on different nodes. Using podAntiAffinity, specify a labelSelector that matches pods for the deployment, and set the topologyKey to kubernetes.io/hostname. --- templates/composer.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/composer.yml b/templates/composer.yml index 0ea3397d9..ac3e9a5bc 100644 --- a/templates/composer.yml +++ b/templates/composer.yml @@ -36,6 +36,15 @@ objects: app: composer spec: serviceAccountName: image-builder + affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchLabels: + app: composer + topologyKey: kubernetes.io/hostname containers: - image: "${IMAGE_NAME}:${IMAGE_TAG}" name: composer