From 1186362784206acf8102aa37286c21b21c1bb76d Mon Sep 17 00:00:00 2001 From: kabicin Date: Fri, 30 Jun 2023 16:30:19 -0400 Subject: [PATCH 1/7] Support zone topology for default affinity --- config/rbac/kind-kuttl-rbac.yaml | 1 + config/rbac/kuttl-rbac.yaml | 1 + config/rbac/minikube-kuttl-rbac.yaml | 1 + controllers/runtimecomponent_controller.go | 16 ++++++++++++++-- utils/utils.go | 12 ++++++++---- utils/utils_test.go | 19 ++++++++++--------- 6 files changed, 35 insertions(+), 15 deletions(-) diff --git a/config/rbac/kind-kuttl-rbac.yaml b/config/rbac/kind-kuttl-rbac.yaml index 9bcc81139..11b50be39 100644 --- a/config/rbac/kind-kuttl-rbac.yaml +++ b/config/rbac/kind-kuttl-rbac.yaml @@ -39,6 +39,7 @@ rules: - namespaces - pods - routes + - nodes verbs: - get - list diff --git a/config/rbac/kuttl-rbac.yaml b/config/rbac/kuttl-rbac.yaml index efc61e175..2ff9da973 100644 --- a/config/rbac/kuttl-rbac.yaml +++ b/config/rbac/kuttl-rbac.yaml @@ -39,6 +39,7 @@ rules: - namespaces - pods - routes + - nodes verbs: - get - list diff --git a/config/rbac/minikube-kuttl-rbac.yaml b/config/rbac/minikube-kuttl-rbac.yaml index f7ef1a6d7..c07c2ea13 100644 --- a/config/rbac/minikube-kuttl-rbac.yaml +++ b/config/rbac/minikube-kuttl-rbac.yaml @@ -40,6 +40,7 @@ rules: - pods - services - routes + - nodes verbs: - get - list diff --git a/controllers/runtimecomponent_controller.go b/controllers/runtimecomponent_controller.go index d489a7ab9..4a9c601b9 100644 --- a/controllers/runtimecomponent_controller.go +++ b/controllers/runtimecomponent_controller.go @@ -337,6 +337,18 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req return r.ManageError(err, common.StatusConditionTypeReconciled, ba) } + // Check nodes to see if it supports zone topology + nodes := &corev1.NodeList{} + isZoneTopologySupported := true + err = r.GetClient().List(context.TODO(), nodes) + if err != nil { + for _, node := range nodes.Items { + if _, found := node.Labels["topology.kubernetes.io/zone"]; !found { + isZoneTopologySupported = false + } + } + } + if instance.Spec.StatefulSet != nil { // Delete Deployment if exists deploy := &appsv1.Deployment{ObjectMeta: defaultMeta} @@ -361,7 +373,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req statefulSet := &appsv1.StatefulSet{ObjectMeta: defaultMeta} err = r.CreateOrUpdate(statefulSet, instance, func() error { appstacksutils.CustomizeStatefulSet(statefulSet, instance) - appstacksutils.CustomizePodSpec(&statefulSet.Spec.Template, instance) + appstacksutils.CustomizePodSpec(&statefulSet.Spec.Template, instance, isZoneTopologySupported) if err := appstacksutils.CustomizePodWithSVCCertificate(&statefulSet.Spec.Template, instance, r.GetClient()); err != nil { return err } @@ -393,7 +405,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req deploy := &appsv1.Deployment{ObjectMeta: defaultMeta} err = r.CreateOrUpdate(deploy, instance, func() error { appstacksutils.CustomizeDeployment(deploy, instance) - appstacksutils.CustomizePodSpec(&deploy.Spec.Template, instance) + appstacksutils.CustomizePodSpec(&deploy.Spec.Template, instance, isZoneTopologySupported) if err := appstacksutils.CustomizePodWithSVCCertificate(&deploy.Spec.Template, instance, r.GetClient()); err != nil { return err } diff --git a/utils/utils.go b/utils/utils.go index 9b23003f6..8c94f32d3 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -466,13 +466,13 @@ func customizeNetworkPolicyPorts(ingress *networkingv1.NetworkPolicyIngressRule, } // CustomizeAffinity ... -func CustomizeAffinity(affinity *corev1.Affinity, ba common.BaseComponent) { +func CustomizeAffinity(affinity *corev1.Affinity, ba common.BaseComponent, isZoneTopologySupported bool) { affinityConfig := ba.GetAffinity() if isCustomAffinityDefined(affinityConfig) { customizeAffinity(affinity, ba.GetAffinity()) } else { obj := ba.(metav1.Object) - customizeDefaultAffinity(affinity, obj.GetName()) + customizeDefaultAffinity(affinity, obj.GetName(), isZoneTopologySupported) } customizeAffinityArchitectures(affinity, affinityConfig) } @@ -533,10 +533,11 @@ func customizeAffinity(affinity *corev1.Affinity, affinityConfig common.BaseComp } } -func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { +func customizeDefaultAffinity(affinity *corev1.Affinity, name string, isZoneTopologySupported bool) { if affinity.PodAntiAffinity == nil { affinity.PodAntiAffinity = &corev1.PodAntiAffinity{} } + term := []corev1.WeightedPodAffinityTerm{ { Weight: 50, @@ -550,6 +551,9 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { }, }, } + if isZoneTopologySupported { + term[0].PodAffinityTerm.TopologyKey = "topology.kubernetes.io/zone" + } affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution = term } @@ -605,7 +609,7 @@ func customizeAffinityArchitectures(affinity *corev1.Affinity, affinityConfig co } // CustomizePodSpec ... -func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) { +func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent, isZoneTopologySupported bool) { obj := ba.(metav1.Object) pts.Labels = ba.GetLabels() pts.Annotations = MergeMaps(pts.Annotations, ba.GetAnnotations()) diff --git a/utils/utils_test.go b/utils/utils_test.go index 88ba92dd8..c67beff75 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -1,12 +1,13 @@ package utils import ( - appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1" "os" "reflect" "strconv" "testing" + appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1" + routev1 "github.com/openshift/api/route/v1" prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" appsv1 "k8s.io/api/apps/v1" @@ -232,7 +233,7 @@ func partialTestCustomizeNodeAffinity(t *testing.T) { Affinity: &affinityConfig, } affinity, runtime := &corev1.Affinity{}, createRuntimeComponent(name, namespace, spec) - CustomizeAffinity(affinity, runtime) + CustomizeAffinity(affinity, runtime, false) expectedMatchExpressions := []corev1.NodeSelectorRequirement{ rDSIDE.NodeSelectorTerms[0].MatchExpressions[0], @@ -282,7 +283,7 @@ func partialTestCustomizePodAffinity(t *testing.T) { Affinity: &affinityConfig, } affinity, runtime := &corev1.Affinity{}, createRuntimeComponent(name, namespace, spec) - CustomizeAffinity(affinity, runtime) + CustomizeAffinity(affinity, runtime, false) testCPA := []Test{ {"Pod Affinity - Required Affinity Term", rDSIDE, @@ -318,7 +319,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // No dep or set, annotation should be empty pts1, runtime1 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts1, runtime1) + CustomizePodSpec(pts1, runtime1, false) annolen1 := len(pts1.Annotations) testAnnotations1 := []Test{ {"Shouldn't be any annotations", 0, annolen1}, @@ -328,7 +329,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // dep but not set, annotation should be dep annotations spec.Deployment = deployment pts2, runtime2 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts2, runtime2) + CustomizePodSpec(pts2, runtime2, false) annolen2 := len(pts2.Annotations) anno2 := pts2.Annotations["depAnno"] testAnnotations2 := []Test{ @@ -341,7 +342,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { spec.Deployment = nil spec.StatefulSet = statefulSet pts3, runtime3 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts3, runtime3) + CustomizePodSpec(pts3, runtime3, false) annolen3 := len(pts3.Annotations) anno3 := pts3.Annotations["setAnno"] testAnnotations3 := []Test{ @@ -353,7 +354,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // dep and set, annotation should be set annotations spec.Deployment = deployment pts4, runtime4 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts4, runtime4) + CustomizePodSpec(pts4, runtime4, false) annolen4 := len(pts4.Annotations) anno4 := pts4.Annotations["setAnno"] testAnnotations4 := []Test{ @@ -381,7 +382,7 @@ func TestCustomizePodSpec(t *testing.T) { } pts, runtime := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) // else cond - CustomizePodSpec(pts, runtime) + CustomizePodSpec(pts, runtime, false) noCont := len(pts.Spec.Containers) noPorts := len(pts.Spec.Containers[0].Ports) ptsSAN := pts.Spec.ServiceAccountName @@ -407,7 +408,7 @@ func TestCustomizePodSpec(t *testing.T) { Affinity: &affinityConfig, } runtime = createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts, runtime) + CustomizePodSpec(pts, runtime, false) ptsCSAN := pts.Spec.ServiceAccountName // affinity tests From 9734c9093d014765eba4899247c6454e8b502024 Mon Sep 17 00:00:00 2001 From: kabicin Date: Wed, 12 Jul 2023 14:26:56 -0400 Subject: [PATCH 2/7] Add zone topology into default pod anti-affinity --- controllers/runtimecomponent_controller.go | 16 ++-------------- utils/utils.go | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/controllers/runtimecomponent_controller.go b/controllers/runtimecomponent_controller.go index 4a9c601b9..d489a7ab9 100644 --- a/controllers/runtimecomponent_controller.go +++ b/controllers/runtimecomponent_controller.go @@ -337,18 +337,6 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req return r.ManageError(err, common.StatusConditionTypeReconciled, ba) } - // Check nodes to see if it supports zone topology - nodes := &corev1.NodeList{} - isZoneTopologySupported := true - err = r.GetClient().List(context.TODO(), nodes) - if err != nil { - for _, node := range nodes.Items { - if _, found := node.Labels["topology.kubernetes.io/zone"]; !found { - isZoneTopologySupported = false - } - } - } - if instance.Spec.StatefulSet != nil { // Delete Deployment if exists deploy := &appsv1.Deployment{ObjectMeta: defaultMeta} @@ -373,7 +361,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req statefulSet := &appsv1.StatefulSet{ObjectMeta: defaultMeta} err = r.CreateOrUpdate(statefulSet, instance, func() error { appstacksutils.CustomizeStatefulSet(statefulSet, instance) - appstacksutils.CustomizePodSpec(&statefulSet.Spec.Template, instance, isZoneTopologySupported) + appstacksutils.CustomizePodSpec(&statefulSet.Spec.Template, instance) if err := appstacksutils.CustomizePodWithSVCCertificate(&statefulSet.Spec.Template, instance, r.GetClient()); err != nil { return err } @@ -405,7 +393,7 @@ func (r *RuntimeComponentReconciler) Reconcile(ctx context.Context, req ctrl.Req deploy := &appsv1.Deployment{ObjectMeta: defaultMeta} err = r.CreateOrUpdate(deploy, instance, func() error { appstacksutils.CustomizeDeployment(deploy, instance) - appstacksutils.CustomizePodSpec(&deploy.Spec.Template, instance, isZoneTopologySupported) + appstacksutils.CustomizePodSpec(&deploy.Spec.Template, instance) if err := appstacksutils.CustomizePodWithSVCCertificate(&deploy.Spec.Template, instance, r.GetClient()); err != nil { return err } diff --git a/utils/utils.go b/utils/utils.go index 8c94f32d3..b8325d29b 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -466,13 +466,13 @@ func customizeNetworkPolicyPorts(ingress *networkingv1.NetworkPolicyIngressRule, } // CustomizeAffinity ... -func CustomizeAffinity(affinity *corev1.Affinity, ba common.BaseComponent, isZoneTopologySupported bool) { +func CustomizeAffinity(affinity *corev1.Affinity, ba common.BaseComponent) { affinityConfig := ba.GetAffinity() if isCustomAffinityDefined(affinityConfig) { customizeAffinity(affinity, ba.GetAffinity()) } else { obj := ba.(metav1.Object) - customizeDefaultAffinity(affinity, obj.GetName(), isZoneTopologySupported) + customizeDefaultAffinity(affinity, obj.GetName()) } customizeAffinityArchitectures(affinity, affinityConfig) } @@ -533,12 +533,23 @@ func customizeAffinity(affinity *corev1.Affinity, affinityConfig common.BaseComp } } -func customizeDefaultAffinity(affinity *corev1.Affinity, name string, isZoneTopologySupported bool) { +func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { if affinity.PodAntiAffinity == nil { affinity.PodAntiAffinity = &corev1.PodAntiAffinity{} } term := []corev1.WeightedPodAffinityTerm{ + { + Weight: 50, + PodAffinityTerm: corev1.PodAffinityTerm{ + TopologyKey: "topology.kubernetes.io/zone", + LabelSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + "app.kubernetes.io/instance": name, + }, + }, + }, + }, { Weight: 50, PodAffinityTerm: corev1.PodAffinityTerm{ @@ -551,9 +562,6 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string, isZoneTopo }, }, } - if isZoneTopologySupported { - term[0].PodAffinityTerm.TopologyKey = "topology.kubernetes.io/zone" - } affinity.PodAntiAffinity.PreferredDuringSchedulingIgnoredDuringExecution = term } @@ -609,7 +617,7 @@ func customizeAffinityArchitectures(affinity *corev1.Affinity, affinityConfig co } // CustomizePodSpec ... -func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent, isZoneTopologySupported bool) { +func CustomizePodSpec(pts *corev1.PodTemplateSpec, ba common.BaseComponent) { obj := ba.(metav1.Object) pts.Labels = ba.GetLabels() pts.Annotations = MergeMaps(pts.Annotations, ba.GetAnnotations()) From 2150e8433d262dc45ad8ee254f684448814fa1d5 Mon Sep 17 00:00:00 2001 From: kabicin Date: Wed, 12 Jul 2023 14:29:51 -0400 Subject: [PATCH 3/7] Revert utils_test.go changes --- config/rbac/kind-kuttl-rbac.yaml | 1 - config/rbac/kuttl-rbac.yaml | 1 - config/rbac/minikube-kuttl-rbac.yaml | 1 - utils/utils_test.go | 16 ++++++++-------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/config/rbac/kind-kuttl-rbac.yaml b/config/rbac/kind-kuttl-rbac.yaml index 11b50be39..9bcc81139 100644 --- a/config/rbac/kind-kuttl-rbac.yaml +++ b/config/rbac/kind-kuttl-rbac.yaml @@ -39,7 +39,6 @@ rules: - namespaces - pods - routes - - nodes verbs: - get - list diff --git a/config/rbac/kuttl-rbac.yaml b/config/rbac/kuttl-rbac.yaml index 2ff9da973..efc61e175 100644 --- a/config/rbac/kuttl-rbac.yaml +++ b/config/rbac/kuttl-rbac.yaml @@ -39,7 +39,6 @@ rules: - namespaces - pods - routes - - nodes verbs: - get - list diff --git a/config/rbac/minikube-kuttl-rbac.yaml b/config/rbac/minikube-kuttl-rbac.yaml index c07c2ea13..f7ef1a6d7 100644 --- a/config/rbac/minikube-kuttl-rbac.yaml +++ b/config/rbac/minikube-kuttl-rbac.yaml @@ -40,7 +40,6 @@ rules: - pods - services - routes - - nodes verbs: - get - list diff --git a/utils/utils_test.go b/utils/utils_test.go index c67beff75..4aa4762a6 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -233,7 +233,7 @@ func partialTestCustomizeNodeAffinity(t *testing.T) { Affinity: &affinityConfig, } affinity, runtime := &corev1.Affinity{}, createRuntimeComponent(name, namespace, spec) - CustomizeAffinity(affinity, runtime, false) + CustomizeAffinity(affinity, runtime) expectedMatchExpressions := []corev1.NodeSelectorRequirement{ rDSIDE.NodeSelectorTerms[0].MatchExpressions[0], @@ -283,7 +283,7 @@ func partialTestCustomizePodAffinity(t *testing.T) { Affinity: &affinityConfig, } affinity, runtime := &corev1.Affinity{}, createRuntimeComponent(name, namespace, spec) - CustomizeAffinity(affinity, runtime, false) + CustomizeAffinity(affinity, runtime) testCPA := []Test{ {"Pod Affinity - Required Affinity Term", rDSIDE, @@ -319,7 +319,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // No dep or set, annotation should be empty pts1, runtime1 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts1, runtime1, false) + CustomizePodSpec(pts1, runtime1) annolen1 := len(pts1.Annotations) testAnnotations1 := []Test{ {"Shouldn't be any annotations", 0, annolen1}, @@ -329,7 +329,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // dep but not set, annotation should be dep annotations spec.Deployment = deployment pts2, runtime2 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts2, runtime2, false) + CustomizePodSpec(pts2, runtime2) annolen2 := len(pts2.Annotations) anno2 := pts2.Annotations["depAnno"] testAnnotations2 := []Test{ @@ -342,7 +342,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { spec.Deployment = nil spec.StatefulSet = statefulSet pts3, runtime3 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts3, runtime3, false) + CustomizePodSpec(pts3, runtime3) annolen3 := len(pts3.Annotations) anno3 := pts3.Annotations["setAnno"] testAnnotations3 := []Test{ @@ -354,7 +354,7 @@ func TestCustomizePodSpecAnnotations(t *testing.T) { // dep and set, annotation should be set annotations spec.Deployment = deployment pts4, runtime4 := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts4, runtime4, false) + CustomizePodSpec(pts4, runtime4) annolen4 := len(pts4.Annotations) anno4 := pts4.Annotations["setAnno"] testAnnotations4 := []Test{ @@ -382,7 +382,7 @@ func TestCustomizePodSpec(t *testing.T) { } pts, runtime := &corev1.PodTemplateSpec{}, createRuntimeComponent(name, namespace, spec) // else cond - CustomizePodSpec(pts, runtime, false) + CustomizePodSpec(pts, runtime) noCont := len(pts.Spec.Containers) noPorts := len(pts.Spec.Containers[0].Ports) ptsSAN := pts.Spec.ServiceAccountName @@ -408,7 +408,7 @@ func TestCustomizePodSpec(t *testing.T) { Affinity: &affinityConfig, } runtime = createRuntimeComponent(name, namespace, spec) - CustomizePodSpec(pts, runtime, false) + CustomizePodSpec(pts, runtime) ptsCSAN := pts.Spec.ServiceAccountName // affinity tests From 8e31e209a8a2eb6a18e8b5fc1e231088e57837dc Mon Sep 17 00:00:00 2001 From: kabicin Date: Wed, 12 Jul 2023 14:30:59 -0400 Subject: [PATCH 4/7] Revert utils_test.go changes --- utils/utils_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/utils_test.go b/utils/utils_test.go index 4aa4762a6..a012e562f 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -1,12 +1,12 @@ package utils import ( + appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1" "os" "reflect" "strconv" "testing" - appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1" routev1 "github.com/openshift/api/route/v1" prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" From 30606d6fe0e94132b808cef5f6604110e74e2765 Mon Sep 17 00:00:00 2001 From: kabicin Date: Wed, 12 Jul 2023 14:31:31 -0400 Subject: [PATCH 5/7] Fix spacing in utils_test.go --- utils/utils_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/utils_test.go b/utils/utils_test.go index a012e562f..88ba92dd8 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -7,7 +7,6 @@ import ( "strconv" "testing" - routev1 "github.com/openshift/api/route/v1" prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" appsv1 "k8s.io/api/apps/v1" From 6dd3cc28d5bb8f094aad840b8e1bb805b63d96b0 Mon Sep 17 00:00:00 2001 From: kabicin Date: Wed, 12 Jul 2023 14:35:49 -0400 Subject: [PATCH 6/7] Lower pod anti-affinity weights --- utils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index b8325d29b..48b41ed6f 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -540,7 +540,7 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { term := []corev1.WeightedPodAffinityTerm{ { - Weight: 50, + Weight: 25, PodAffinityTerm: corev1.PodAffinityTerm{ TopologyKey: "topology.kubernetes.io/zone", LabelSelector: &metav1.LabelSelector{ @@ -551,7 +551,7 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { }, }, { - Weight: 50, + Weight: 25, PodAffinityTerm: corev1.PodAffinityTerm{ TopologyKey: "kubernetes.io/hostname", LabelSelector: &metav1.LabelSelector{ From a128965bbe8fed6fd621f15bb6bc9ae6b49b2131 Mon Sep 17 00:00:00 2001 From: kabicin Date: Fri, 14 Jul 2023 11:24:04 -0400 Subject: [PATCH 7/7] Restore PodAntiAffinity weights --- utils/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 48b41ed6f..b8325d29b 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -540,7 +540,7 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { term := []corev1.WeightedPodAffinityTerm{ { - Weight: 25, + Weight: 50, PodAffinityTerm: corev1.PodAffinityTerm{ TopologyKey: "topology.kubernetes.io/zone", LabelSelector: &metav1.LabelSelector{ @@ -551,7 +551,7 @@ func customizeDefaultAffinity(affinity *corev1.Affinity, name string) { }, }, { - Weight: 25, + Weight: 50, PodAffinityTerm: corev1.PodAffinityTerm{ TopologyKey: "kubernetes.io/hostname", LabelSelector: &metav1.LabelSelector{