Skip to content

Commit f01a2bf

Browse files
author
Kubernetes Submit Queue
authored
Merge pull request kubernetes#60532 from mtaufen/automated-cherry-pick-of-#60246-upstream-release-1.9
Automatic merge from submit-queue. Automated cherry pick of kubernetes#60246 upstream release 1.9 Cherry pick of kubernetes#60246 on release-1.9 kubernetes#60246: backoff runtime errors in kubelet sync loop ```release-note NONE ``` /cc @mbohlool
2 parents a486807 + 0c3e53b commit f01a2bf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/kubelet/kubelet.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package kubelet
1919
import (
2020
"crypto/tls"
2121
"fmt"
22+
"math"
2223
"net"
2324
"net/http"
2425
"net/url"
@@ -1777,12 +1778,22 @@ func (kl *Kubelet) syncLoop(updates <-chan kubetypes.PodUpdate, handler SyncHand
17771778
housekeepingTicker := time.NewTicker(housekeepingPeriod)
17781779
defer housekeepingTicker.Stop()
17791780
plegCh := kl.pleg.Watch()
1781+
const (
1782+
base = 100 * time.Millisecond
1783+
max = 5 * time.Second
1784+
factor = 2
1785+
)
1786+
duration := base
17801787
for {
17811788
if rs := kl.runtimeState.runtimeErrors(); len(rs) != 0 {
17821789
glog.Infof("skipping pod synchronization - %v", rs)
1783-
time.Sleep(5 * time.Second)
1790+
// exponential backoff
1791+
time.Sleep(duration)
1792+
duration = time.Duration(math.Min(float64(max), factor*float64(duration)))
17841793
continue
17851794
}
1795+
// reset backoff if we have a success
1796+
duration = base
17861797

17871798
kl.syncLoopMonitor.Store(kl.clock.Now())
17881799
if !kl.syncLoopIteration(updates, handler, syncTicker.C, housekeepingTicker.C, plegCh) {

0 commit comments

Comments
 (0)