@@ -1281,6 +1281,9 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
12811281 lb .opts .SubnetId = subnetID
12821282 }
12831283
1284+ floatingPool := getStringFromServiceAnnotation (apiService , ServiceAnnotationLoadBalancerFloatingNetworkId , lb .opts .FloatingNetworkId )
1285+ glog .V (4 ).Infof ("EnsureLoadBalancer using floatingPool: %v" , floatingPool )
1286+
12841287 ports := apiService .Spec .Ports
12851288 if len (ports ) > 1 {
12861289 return nil , fmt .Errorf ("multiple ports are not supported in openstack v1 load balancers" )
@@ -1404,9 +1407,9 @@ func (lb *LbaasV1) EnsureLoadBalancer(clusterName string, apiService *v1.Service
14041407
14051408 status .Ingress = []v1.LoadBalancerIngress {{IP : vip .Address }}
14061409
1407- if lb . opts . FloatingNetworkId != "" {
1410+ if floatingPool != "" {
14081411 floatIPOpts := floatingips.CreateOpts {
1409- FloatingNetworkID : lb . opts . FloatingNetworkId ,
1412+ FloatingNetworkID : floatingPool ,
14101413 PortID : vip .PortID ,
14111414 }
14121415 floatIP , err := floatingips .Create (lb .network , floatIPOpts ).Extract ()
@@ -1492,7 +1495,7 @@ func (lb *LbaasV1) EnsureLoadBalancerDeleted(clusterName string, service *v1.Ser
14921495 return err
14931496 }
14941497
1495- if lb . opts . FloatingNetworkId != "" && vip != nil {
1498+ if vip != nil && vip . PortID != "" {
14961499 floatingIP , err := getFloatingIPByPortID (lb .network , vip .PortID )
14971500 if err != nil && ! isNotFound (err ) {
14981501 return err
0 commit comments