Skip to content

Commit 63bd6e5

Browse files
jichenjcmandre
authored andcommitted
[OCCM] add environment variable for timeout (kubernetes#2235)
1 parent d10090c commit 63bd6e5

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/openstack-cloud-controller-manager/using-openstack-cloud-controller-manager.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ NOTE:
289289
290290
* When using `ovn` provider service has limited scope - `create_monitor` is not supported and only supported `lb-method` is `SOURCE_IP`.
291291
292+
* environment variable `OCCM_WAIT_LB_ACTIVE_STEPS` is used to provide steps of waiting loadbalancer to be ready. Current default wait steps is 23 and setup the environment variable overrides default value. Refer to [Backoff.Steps](https://pkg.go.dev/k8s.io/apimachinery/pkg/util/wait#Backoff) for further information.
293+
292294
### Metadata
293295
294296
* `search-order`

pkg/util/openstack/loadbalancer.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ package openstack
1818

1919
import (
2020
"fmt"
21+
"os"
22+
"strconv"
2123
"time"
2224

2325
"github.com/gophercloud/gophercloud"
@@ -159,13 +161,24 @@ func IsOctaviaFeatureSupported(client *gophercloud.ServiceClient, feature int, l
159161
return false
160162
}
161163

164+
func getTimeoutSteps(name string, steps int) int {
165+
if v := os.Getenv(name); v != "" {
166+
s, err := strconv.Atoi(v)
167+
if err == nil && s >= 0 {
168+
return s
169+
}
170+
}
171+
return steps
172+
}
173+
162174
// WaitActiveAndGetLoadBalancer wait for LB active then return the LB object for further usage
163175
func WaitActiveAndGetLoadBalancer(client *gophercloud.ServiceClient, loadbalancerID string) (*loadbalancers.LoadBalancer, error) {
164176
klog.InfoS("Waiting for load balancer ACTIVE", "lbID", loadbalancerID)
177+
steps := getTimeoutSteps("OCCM_WAIT_LB_ACTIVE_STEPS", waitLoadbalancerActiveSteps)
165178
backoff := wait.Backoff{
166179
Duration: waitLoadbalancerInitDelay,
167180
Factor: waitLoadbalancerFactor,
168-
Steps: waitLoadbalancerActiveSteps,
181+
Steps: steps,
169182
}
170183

171184
var loadbalancer *loadbalancers.LoadBalancer

0 commit comments

Comments
 (0)