Skip to content

Commit 822dd25

Browse files
dulekmandre
authored andcommitted
Wait for LB to be ACTIVE on HM update (kubernetes#2280)
This commit makes sure that on exit from UpdateHealthMonitor() the LB is ACTIVE so that next operations can be called safely.
1 parent 82c5944 commit 822dd25

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pkg/openstack/loadbalancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ func (lbaas *LbaasV2) ensureOctaviaHealthMonitor(lbID string, name string, pool
10991099
MaxRetriesDown: svcConf.healthMonitorMaxRetriesDown,
11001100
}
11011101
klog.Infof("Updating health monitor %s updateOpts %+v", monitorID, updateOpts)
1102-
return openstackutil.UpdateHealthMonitor(lbaas.lb, monitorID, updateOpts)
1102+
return openstackutil.UpdateHealthMonitor(lbaas.lb, monitorID, updateOpts, lbID)
11031103
}
11041104

11051105
return nil

pkg/util/openstack/loadbalancer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,13 +668,17 @@ func CreateL7Rule(client *gophercloud.ServiceClient, policyID string, opts l7pol
668668
}
669669

670670
// UpdateHealthMonitor updates a health monitor.
671-
func UpdateHealthMonitor(client *gophercloud.ServiceClient, monitorID string, opts monitors.UpdateOpts) error {
671+
func UpdateHealthMonitor(client *gophercloud.ServiceClient, monitorID string, opts monitors.UpdateOpts, lbID string) error {
672672
mc := metrics.NewMetricContext("loadbalancer_healthmonitor", "update")
673673
_, err := monitors.Update(client, monitorID, opts).Extract()
674674
if mc.ObserveRequest(err) != nil {
675675
return fmt.Errorf("failed to update healthmonitor: %v", err)
676676
}
677677

678+
if _, err := WaitActiveAndGetLoadBalancer(client, lbID); err != nil {
679+
return fmt.Errorf("failed to wait for load balancer %s ACTIVE after updating healthmonitor: %v", lbID, err)
680+
}
681+
678682
return nil
679683
}
680684

0 commit comments

Comments
 (0)