Merge pull request #90280 from gaurav1086/azure_lb_remove_unncessary_check

[Provider/Azure] remove unncessary nil check for range
This commit is contained in:
Kubernetes Prow Robot 2020-04-19 18:05:38 -07:00 committed by GitHub
commit 32540b0eaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,26 +265,24 @@ func (az *Cloud) getServiceLoadBalancer(service *v1.Service, clusterName string,
}
// check if the service already has a load balancer
if existingLBs != nil {
for i := range existingLBs {
existingLB := existingLBs[i]
if strings.EqualFold(*existingLB.Name, defaultLBName) {
defaultLB = &existingLB
}
if isInternalLoadBalancer(&existingLB) != isInternal {
continue
}
status, err = az.getServiceLoadBalancerStatus(service, &existingLB)
if err != nil {
return nil, nil, false, err
}
if status == nil {
// service is not on this load balancer
continue
}
return &existingLB, status, true, nil
for i := range existingLBs {
existingLB := existingLBs[i]
if strings.EqualFold(*existingLB.Name, defaultLBName) {
defaultLB = &existingLB
}
if isInternalLoadBalancer(&existingLB) != isInternal {
continue
}
status, err = az.getServiceLoadBalancerStatus(service, &existingLB)
if err != nil {
return nil, nil, false, err
}
if status == nil {
// service is not on this load balancer
continue
}
return &existingLB, status, true, nil
}
hasMode, _, _ := getServiceLoadBalancerMode(service)