Skip to content

Commit

Permalink
Merge pull request kubernetes#60532 from mtaufen/automated-cherry-pic…
Browse files Browse the repository at this point in the history
…k-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
  • Loading branch information
Kubernetes Submit Queue authored Mar 17, 2018
2 parents a486807 + 0c3e53b commit f01a2bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ package kubelet
import (
"crypto/tls"
"fmt"
"math"
"net"
"net/http"
"net/url"
@@ -1777,12 +1778,22 @@ func (kl *Kubelet) syncLoop(updates <-chan kubetypes.PodUpdate, handler SyncHand
housekeepingTicker := time.NewTicker(housekeepingPeriod)
defer housekeepingTicker.Stop()
plegCh := kl.pleg.Watch()
const (
base = 100 * time.Millisecond
max = 5 * time.Second
factor = 2
)
duration := base
for {
if rs := kl.runtimeState.runtimeErrors(); len(rs) != 0 {
glog.Infof("skipping pod synchronization - %v", rs)
time.Sleep(5 * time.Second)
// exponential backoff
time.Sleep(duration)
duration = time.Duration(math.Min(float64(max), factor*float64(duration)))
continue
}
// reset backoff if we have a success
duration = base

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

0 comments on commit f01a2bf

Please sign in to comment.