Skip to content

Commit a59fec2

Browse files
authored
nit: rename function WaitLoadbalancerActive (kubernetes#2068)
1 parent f62c419 commit a59fec2

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

pkg/openstack/loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ func (lbaas *LbaasV2) createFullyPopulatedOctaviaLoadBalancer(name, clusterName
550550
svcConf.lbMemberSubnetID = loadbalancer.VipSubnetID
551551
}
552552

553-
if loadbalancer, err = openstackutil.WaitLoadbalancerActive(lbaas.lb, loadbalancer.ID); err != nil {
553+
if loadbalancer, err = openstackutil.WaitActiveAndGetLoadBalancer(lbaas.lb, loadbalancer.ID); err != nil {
554554
return nil, err
555555
}
556556

pkg/util/openstack/loadbalancer.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ func IsOctaviaFeatureSupported(client *gophercloud.ServiceClient, feature int, l
159159
return false
160160
}
161161

162-
func WaitLoadbalancerActive(client *gophercloud.ServiceClient, loadbalancerID string) (*loadbalancers.LoadBalancer, error) {
162+
// WaitActiveAndGetLoadBalancer wait for LB active then return the LB object for further usage
163+
func WaitActiveAndGetLoadBalancer(client *gophercloud.ServiceClient, loadbalancerID string) (*loadbalancers.LoadBalancer, error) {
163164
klog.InfoS("Waiting for load balancer ACTIVE", "lbID", loadbalancerID)
164165
backoff := wait.Backoff{
165166
Duration: waitLoadbalancerInitDelay,
@@ -256,7 +257,7 @@ func UpdateLoadBalancerTags(client *gophercloud.ServiceClient, lbID string, tags
256257
return err
257258
}
258259

259-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
260+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
260261
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after updating: %v", lbID, err)
261262
}
262263

@@ -320,7 +321,7 @@ func UpdateListener(client *gophercloud.ServiceClient, lbID string, listenerID s
320321
return err
321322
}
322323

323-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
324+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
324325
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after updating listener: %v", lbID, err)
325326
}
326327

@@ -335,7 +336,7 @@ func CreateListener(client *gophercloud.ServiceClient, lbID string, opts listene
335336
return nil, err
336337
}
337338

338-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
339+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
339340
return nil, fmt.Errorf("failed to wait for load balancer %s ACTIVE after creating listener: %v", lbID, err)
340341
}
341342

@@ -354,7 +355,7 @@ func DeleteListener(client *gophercloud.ServiceClient, listenerID string, lbID s
354355
}
355356
}
356357

357-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
358+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
358359
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after deleting listener: %v", lbID, err)
359360
}
360361

@@ -421,7 +422,7 @@ func CreatePool(client *gophercloud.ServiceClient, opts pools.CreateOptsBuilder,
421422
return nil, err
422423
}
423424

424-
if _, err = WaitLoadbalancerActive(client, lbID); err != nil {
425+
if _, err = WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
425426
return nil, fmt.Errorf("failed to wait for load balancer ACTIVE after creating pool: %v", err)
426427
}
427428

@@ -551,7 +552,7 @@ func DeletePool(client *gophercloud.ServiceClient, poolID string, lbID string) e
551552
return fmt.Errorf("error deleting pool %s for load balancer %s: %v", poolID, lbID, err)
552553
}
553554
}
554-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
555+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
555556
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after deleting pool: %v", lbID, err)
556557
}
557558

@@ -566,7 +567,7 @@ func BatchUpdatePoolMembers(client *gophercloud.ServiceClient, lbID string, pool
566567
return err
567568
}
568569

569-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
570+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
570571
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after updating pool members for %s: %v", lbID, poolID, err)
571572
}
572573

@@ -602,7 +603,7 @@ func CreateL7Policy(client *gophercloud.ServiceClient, opts l7policies.CreateOpt
602603
return nil, err
603604
}
604605

605-
if _, err = WaitLoadbalancerActive(client, lbID); err != nil {
606+
if _, err = WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
606607
return nil, fmt.Errorf("failed to wait for load balancer ACTIVE after creating l7policy: %v", err)
607608
}
608609

@@ -616,7 +617,7 @@ func DeleteL7policy(client *gophercloud.ServiceClient, policyID string, lbID str
616617
return err
617618
}
618619

619-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
620+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
620621
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after deleting l7policy: %v", lbID, err)
621622
}
622623

@@ -646,7 +647,7 @@ func CreateL7Rule(client *gophercloud.ServiceClient, policyID string, opts l7pol
646647
return err
647648
}
648649

649-
if _, err = WaitLoadbalancerActive(client, lbID); err != nil {
650+
if _, err = WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
650651
return fmt.Errorf("failed to wait for load balancer ACTIVE after creating l7policy rule: %v", err)
651652
}
652653

@@ -672,7 +673,7 @@ func DeleteHealthMonitor(client *gophercloud.ServiceClient, monitorID string, lb
672673
return mc.ObserveRequest(err)
673674
}
674675
_ = mc.ObserveRequest(nil)
675-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
676+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
676677
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after deleting healthmonitor: %v", lbID, err)
677678
}
678679

@@ -687,7 +688,7 @@ func CreateHealthMonitor(client *gophercloud.ServiceClient, opts monitors.Create
687688
return nil, fmt.Errorf("failed to create healthmonitor: %v", err)
688689
}
689690

690-
if _, err := WaitLoadbalancerActive(client, lbID); err != nil {
691+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
691692
return nil, fmt.Errorf("failed to wait for load balancer %s ACTIVE after creating healthmonitor: %v", lbID, err)
692693
}
693694

0 commit comments

Comments
 (0)