Start synchronizing pods after network is ready.

This commit is contained in:
Krzysztof Jastrzebski
2018-09-17 20:42:18 +02:00
parent 5dc2c13e74
commit ad330f7dbe
4 changed files with 32 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ package kubelet
import (
"fmt"
"strings"
"sync"
"time"
@@ -96,8 +97,11 @@ const (
// jitter factor for resyncInterval
workerResyncIntervalJitterFactor = 0.5
// jitter factor for backOffPeriod
// jitter factor for backOffPeriod and backOffOnTransientErrorPeriod
workerBackOffPeriodJitterFactor = 0.5
// backoff period when transient error occurred.
backOffOnTransientErrorPeriod = time.Second
)
type podWorkers struct {
@@ -263,6 +267,9 @@ func (p *podWorkers) wrapUp(uid types.UID, syncErr error) {
case syncErr == nil:
// No error; requeue at the regular resync interval.
p.workQueue.Enqueue(uid, wait.Jitter(p.resyncInterval, workerResyncIntervalJitterFactor))
case strings.Contains(syncErr.Error(), NetworkNotReadyErrorMsg):
// Network is not ready; back off for short period of time and retry as network might be ready soon.
p.workQueue.Enqueue(uid, wait.Jitter(backOffOnTransientErrorPeriod, workerBackOffPeriodJitterFactor))
default:
// Error occurred during the sync; back off and then retry.
p.workQueue.Enqueue(uid, wait.Jitter(p.backOffPeriod, workerBackOffPeriodJitterFactor))