Commit 0ce1cc99 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 1e364804 70a0f443
...@@ -881,10 +881,6 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv ...@@ -881,10 +881,6 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv
glog.V(2).Infof("Deleted obsolete listener: %s", listener.ID) glog.V(2).Infof("Deleted obsolete listener: %s", listener.ID)
} }
status := &v1.LoadBalancerStatus{}
status.Ingress = []v1.LoadBalancerIngress{{IP: loadbalancer.VipAddress}}
portID := loadbalancer.VipPortID portID := loadbalancer.VipPortID
floatIP, err := getFloatingIPByPortID(lbaas.network, portID) floatIP, err := getFloatingIPByPortID(lbaas.network, portID)
if err != nil && err != ErrNotFound { if err != nil && err != ErrNotFound {
...@@ -907,8 +903,13 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv ...@@ -907,8 +903,13 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv
return nil, fmt.Errorf("Error creating LB floatingip %+v: %v", floatIPOpts, err) return nil, fmt.Errorf("Error creating LB floatingip %+v: %v", floatIPOpts, err)
} }
} }
status := &v1.LoadBalancerStatus{}
if floatIP != nil { if floatIP != nil {
status.Ingress = append(status.Ingress, v1.LoadBalancerIngress{IP: floatIP.FloatingIP}) status.Ingress = []v1.LoadBalancerIngress{{IP: floatIP.FloatingIP}}
} else {
status.Ingress = []v1.LoadBalancerIngress{{IP: loadbalancer.VipAddress}}
} }
if lbaas.opts.ManageSecurityGroups { if lbaas.opts.ManageSecurityGroups {
...@@ -1474,9 +1475,6 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service ...@@ -1474,9 +1475,6 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
} }
status := &v1.LoadBalancerStatus{} status := &v1.LoadBalancerStatus{}
status.Ingress = []v1.LoadBalancerIngress{{IP: vip.Address}}
if floatingPool != "" && !internalAnnotation { if floatingPool != "" && !internalAnnotation {
floatIPOpts := floatingips.CreateOpts{ floatIPOpts := floatingips.CreateOpts{
FloatingNetworkID: floatingPool, FloatingNetworkID: floatingPool,
...@@ -1493,7 +1491,9 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service ...@@ -1493,7 +1491,9 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
return nil, fmt.Errorf("Error creating floatingip for openstack load balancer %s: %v", name, err) return nil, fmt.Errorf("Error creating floatingip for openstack load balancer %s: %v", name, err)
} }
status.Ingress = append(status.Ingress, v1.LoadBalancerIngress{IP: floatIP.FloatingIP}) status.Ingress = []v1.LoadBalancerIngress{{IP: floatIP.FloatingIP}}
} else {
status.Ingress = []v1.LoadBalancerIngress{{IP: vip.Address}}
} }
return status, nil return status, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment