From e69783d00d1ad00c168df96d9cc13e532c41378b Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Tue, 11 Oct 2022 15:59:05 +0300 Subject: [PATCH 1/2] Use anti-affinity on kubernetes.io/hostname when scheduling Operator Pods --- config/manager/manager.yaml | 9 +++++++++ helm-charts/coherence-operator/templates/deployment.yaml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 7fc883a61..8d9e183eb 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -96,6 +96,15 @@ spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + control-plane: coherence + app.kubernetes.io/name: coherence-operator + app.kubernetes.io/instance: coherence-operator-manager + app.kubernetes.io/version: "3.2.9" + weight: 50 - podAffinityTerm: topologyKey: "topology.kubernetes.io/zone" labelSelector: diff --git a/helm-charts/coherence-operator/templates/deployment.yaml b/helm-charts/coherence-operator/templates/deployment.yaml index 61acbad72..be6dc5921 100644 --- a/helm-charts/coherence-operator/templates/deployment.yaml +++ b/helm-charts/coherence-operator/templates/deployment.yaml @@ -189,6 +189,15 @@ spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + topologyKey: "kubernetes.io/hostname" + labelSelector: + matchLabels: + control-plane: coherence + app.kubernetes.io/name: coherence-operator + app.kubernetes.io/instance: coherence-operator-manager + app.kubernetes.io/version: "${VERSION}" + weight: 50 - podAffinityTerm: topologyKey: "topology.kubernetes.io/zone" labelSelector: From 96407ea2198950b3538006006b8c775ca6987db4 Mon Sep 17 00:00:00 2001 From: Jonathan Knight Date: Thu, 13 Oct 2022 14:44:00 +0300 Subject: [PATCH 2/2] Change anti-affinity weights --- config/manager/manager.yaml | 8 ++++---- helm-charts/coherence-operator/templates/deployment.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 8d9e183eb..f0467f0e7 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -97,7 +97,7 @@ spec: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: - topologyKey: "kubernetes.io/hostname" + topologyKey: "topology.kubernetes.io/zone" labelSelector: matchLabels: control-plane: coherence @@ -106,16 +106,16 @@ spec: app.kubernetes.io/version: "3.2.9" weight: 50 - podAffinityTerm: - topologyKey: "topology.kubernetes.io/zone" + topologyKey: "oci.oraclecloud.com/fault-domain" labelSelector: matchLabels: control-plane: coherence app.kubernetes.io/name: coherence-operator app.kubernetes.io/instance: coherence-operator-manager app.kubernetes.io/version: "3.2.9" - weight: 50 + weight: 10 - podAffinityTerm: - topologyKey: "oci.oraclecloud.com/fault-domain" + topologyKey: "kubernetes.io/hostname" labelSelector: matchLabels: control-plane: coherence diff --git a/helm-charts/coherence-operator/templates/deployment.yaml b/helm-charts/coherence-operator/templates/deployment.yaml index be6dc5921..7ff959ada 100644 --- a/helm-charts/coherence-operator/templates/deployment.yaml +++ b/helm-charts/coherence-operator/templates/deployment.yaml @@ -190,7 +190,7 @@ spec: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: - topologyKey: "kubernetes.io/hostname" + topologyKey: "topology.kubernetes.io/zone" labelSelector: matchLabels: control-plane: coherence @@ -199,16 +199,16 @@ spec: app.kubernetes.io/version: "${VERSION}" weight: 50 - podAffinityTerm: - topologyKey: "topology.kubernetes.io/zone" + topologyKey: "oci.oraclecloud.com/fault-domain" labelSelector: matchLabels: control-plane: coherence app.kubernetes.io/name: coherence-operator app.kubernetes.io/instance: coherence-operator-manager app.kubernetes.io/version: "${VERSION}" - weight: 50 + weight: 10 - podAffinityTerm: - topologyKey: "oci.oraclecloud.com/fault-domain" + topologyKey: "kubernetes.io/hostname" labelSelector: matchLabels: control-plane: coherence