From 799b52ac2187cd8abf584ae2dfbdc61f7c0c10ec Mon Sep 17 00:00:00 2001 From: Mike Beaumont Date: Tue, 5 Nov 2024 20:51:18 +0100 Subject: [PATCH] fix(MeshLoadBalancingStrategy): set all priorities equal is localityAwareness is disabled Signed-off-by: Mike Beaumont --- .../meshloadbalancingstrategy/plugin/v1alpha1/plugin.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/plugins/policies/meshloadbalancingstrategy/plugin/v1alpha1/plugin.go b/pkg/plugins/policies/meshloadbalancingstrategy/plugin/v1alpha1/plugin.go index 55288733f415..99ab9e3c8719 100644 --- a/pkg/plugins/policies/meshloadbalancingstrategy/plugin/v1alpha1/plugin.go +++ b/pkg/plugins/policies/meshloadbalancingstrategy/plugin/v1alpha1/plugin.go @@ -233,6 +233,15 @@ func configureEndpoints( } } } + if conf.LocalityAwareness != nil && pointer.Deref(conf.LocalityAwareness.Disabled) { + for _, cla := range endpoints { + for _, localityLbEndpoints := range cla.Endpoints { + if localityLbEndpoints.Locality != nil && localityLbEndpoints.Locality.Zone != localZone { + localityLbEndpoints.Priority = 0 + } + } + } + } return nil }