From 0f0e271936d94a88deb7f0469c3c45ef4d77ad88 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Thu, 12 Apr 2018 15:57:44 +0800 Subject: [PATCH] Ensure expected load balancer is selected for Azure Without this, the last element of LB list is always selected. --- pkg/cloudprovider/providers/azure/azure_loadbalancer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/azure/azure_loadbalancer.go b/pkg/cloudprovider/providers/azure/azure_loadbalancer.go index 5267b736add..44b59062314 100644 --- a/pkg/cloudprovider/providers/azure/azure_loadbalancer.go +++ b/pkg/cloudprovider/providers/azure/azure_loadbalancer.go @@ -199,7 +199,8 @@ func (az *Cloud) getServiceLoadBalancer(service *v1.Service, clusterName string, // check if the service already has a load balancer if existingLBs != nil { - for _, existingLB := range existingLBs { + for i := range existingLBs { + existingLB := existingLBs[i] if strings.EqualFold(*existingLB.Name, defaultLBName) { defaultLB = &existingLB }