Skip to content

Commit ac0793c

Browse files
author
Ravi Sankar Penta
committed
Fix SDN exponential backoff timeouts
- First iteration of wait.ExponentialBackoff() will not wait, so the times will be: 0, a, a * r, a * r^2, ... a * r^n-2 [a: duration, r: factor, n: steps] Total = a * (r^(n-1) - 1)/(r-1))
1 parent 4d15c88 commit ac0793c

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

pkg/network/node/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (node *OsdnNode) getRuntimeService() (kubeletapi.RuntimeService, error) {
2323
kwait.Backoff{
2424
Duration: 100 * time.Millisecond,
2525
Factor: 1.2,
26-
Steps: 23,
26+
Steps: 24,
2727
},
2828
func() (bool, error) {
2929
runtimeService, err := kubeletremote.NewRemoteRuntimeService(node.runtimeEndpoint, node.runtimeRequestTimeout)

pkg/network/node/sdn_controller.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ func (plugin *OsdnNode) getLocalSubnet() (string, error) {
3030
// unexpectedly long though, so give it plenty of time before returning an error
3131
// (since that will cause the node process to exit).
3232
backoff := utilwait.Backoff{
33-
// A bit over 1 minute total
33+
// ~2 mins total
3434
Duration: time.Second,
3535
Factor: 1.5,
36-
Steps: 8,
36+
Steps: 11,
3737
}
3838
err := utilwait.ExponentialBackoff(backoff, func() (bool, error) {
3939
var err error
@@ -106,10 +106,11 @@ func (plugin *OsdnNode) alreadySetUp(localSubnetGatewayCIDR string, clusterNetwo
106106
}
107107

108108
func deleteLocalSubnetRoute(device, localSubnetCIDR string) {
109+
// ~1 sec total
109110
backoff := utilwait.Backoff{
110111
Duration: 100 * time.Millisecond,
111112
Factor: 1.25,
112-
Steps: 6,
113+
Steps: 7,
113114
}
114115
err := utilwait.ExponentialBackoff(backoff, func() (bool, error) {
115116
l, err := netlink.LinkByName(device)

pkg/oc/admin/diagnostics/diagnostics/network/run_pod.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (d *NetworkDiagnostic) runNetworkDiagnostic() {
143143
return
144144
}
145145
// Wait for network diagnostic pod completion (timeout: ~3 mins)
146-
backoff := wait.Backoff{Steps: 38, Duration: 500 * time.Millisecond, Factor: 1.1}
146+
backoff := wait.Backoff{Steps: 39, Duration: 500 * time.Millisecond, Factor: 1.1}
147147
if err := d.waitForNetworkPod(d.nsName1, util.NetworkDiagPodNamePrefix, backoff, []kapi.PodPhase{kapi.PodSucceeded, kapi.PodFailed}); err != nil {
148148
d.res.Error("DNet2007", err, err.Error())
149149
return
@@ -164,7 +164,7 @@ func (d *NetworkDiagnostic) runNetworkDiagnostic() {
164164
}
165165

166166
// Wait for network diagnostic pod to start (timeout: ~5 mins)
167-
backoff = wait.Backoff{Steps: 36, Duration: time.Second, Factor: 1.1}
167+
backoff = wait.Backoff{Steps: 37, Duration: time.Second, Factor: 1.1}
168168
if err := d.waitForNetworkPod(d.nsName1, util.NetworkDiagPodNamePrefix, backoff, []kapi.PodPhase{kapi.PodRunning, kapi.PodFailed, kapi.PodSucceeded}); err != nil {
169169
d.res.Error("DNet2010", err, err.Error())
170170
// Do not bail out here, collect what ever info is available from all valid nodes

pkg/oc/admin/diagnostics/diagnostics/network/setup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (d *NetworkDiagnostic) waitForTestPodAndService(nsList []string) error {
155155
errList := []error{}
156156
validPhases := []kapi.PodPhase{kapi.PodRunning, kapi.PodSucceeded, kapi.PodFailed}
157157
for _, name := range nsList {
158-
backoff := wait.Backoff{Steps: 36, Duration: time.Second, Factor: 1.1} // timeout: ~5 mins
158+
backoff := wait.Backoff{Steps: 37, Duration: time.Second, Factor: 1.1} // timeout: ~5 mins
159159
if err := d.waitForNetworkPod(name, util.NetworkDiagTestPodNamePrefix, backoff, validPhases); err != nil {
160160
errList = append(errList, err)
161161
}

0 commit comments

Comments
 (0)