Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit dfbbd7a

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request #52609 from FengyunPan/register-internal-ip
Automatic merge from submit-queue (batch tested with PRs 52751, 52898, 52633, 52611, 52609). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Only register floatingIP for external loadbalancer service If the user has provided the floating-ip options, then it's safe to assume they want (only) the floating-ip to be the ingress IP; if they have not provided floating-ip options, then the LB IP is the only relevant value. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # Fix #52566 **Release note**: ```release-note Only register floatingIP into Loadbalancer ingress field for external loadbalancer service ```
2 parents 7849325 + 759a30c commit dfbbd7a

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,6 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv
881881
glog.V(2).Infof("Deleted obsolete listener: %s", listener.ID)
882882
}
883883

884-
status := &v1.LoadBalancerStatus{}
885-
886-
status.Ingress = []v1.LoadBalancerIngress{{IP: loadbalancer.VipAddress}}
887-
888884
portID := loadbalancer.VipPortID
889885
floatIP, err := getFloatingIPByPortID(lbaas.network, portID)
890886
if err != nil && err != ErrNotFound {
@@ -907,8 +903,13 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv
907903
return nil, fmt.Errorf("Error creating LB floatingip %+v: %v", floatIPOpts, err)
908904
}
909905
}
906+
907+
status := &v1.LoadBalancerStatus{}
908+
910909
if floatIP != nil {
911-
status.Ingress = append(status.Ingress, v1.LoadBalancerIngress{IP: floatIP.FloatingIP})
910+
status.Ingress = []v1.LoadBalancerIngress{{IP: floatIP.FloatingIP}}
911+
} else {
912+
status.Ingress = []v1.LoadBalancerIngress{{IP: loadbalancer.VipAddress}}
912913
}
913914

914915
if lbaas.opts.ManageSecurityGroups {
@@ -1474,9 +1475,6 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
14741475
}
14751476

14761477
status := &v1.LoadBalancerStatus{}
1477-
1478-
status.Ingress = []v1.LoadBalancerIngress{{IP: vip.Address}}
1479-
14801478
if floatingPool != "" && !internalAnnotation {
14811479
floatIPOpts := floatingips.CreateOpts{
14821480
FloatingNetworkID: floatingPool,
@@ -1493,7 +1491,9 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
14931491
return nil, fmt.Errorf("Error creating floatingip for openstack load balancer %s: %v", name, err)
14941492
}
14951493

1496-
status.Ingress = append(status.Ingress, v1.LoadBalancerIngress{IP: floatIP.FloatingIP})
1494+
status.Ingress = []v1.LoadBalancerIngress{{IP: floatIP.FloatingIP}}
1495+
} else {
1496+
status.Ingress = []v1.LoadBalancerIngress{{IP: vip.Address}}
14971497
}
14981498

14991499
return status, nil

0 commit comments

Comments
 (0)