Integrate backoff mechanism into the scheduling queue and remove the Backoff util

This commit is contained in:
goodluckbot
2019-04-06 00:15:00 +08:00
parent 9f15368c5c
commit 151649df4c
11 changed files with 251 additions and 375 deletions

View File

@@ -214,7 +214,7 @@ type PriorityQueue struct {
stop <-chan struct{}
clock util.Clock
// podBackoff tracks backoff for pods attempting to be rescheduled
podBackoff *util.PodBackoff
podBackoff *PodBackoffMap
lock sync.RWMutex
cond sync.Cond
@@ -295,7 +295,7 @@ func NewPriorityQueueWithClock(stop <-chan struct{}, clock util.Clock) *Priority
pq := &PriorityQueue{
clock: clock,
stop: stop,
podBackoff: util.CreatePodBackoffWithClock(1*time.Second, 10*time.Second, clock),
podBackoff: NewPodBackoffMap(1*time.Second, 10*time.Second),
activeQ: util.NewHeap(podInfoKeyFunc, activeQComp),
unschedulableQ: newUnschedulablePodsMap(),
nominatedPods: newNominatedPodMap(),
@@ -396,7 +396,7 @@ func (p *PriorityQueue) isPodBackingOff(pod *v1.Pod) bool {
// backoffPod checks if pod is currently undergoing backoff. If it is not it updates the backoff
// timeout otherwise it does nothing.
func (p *PriorityQueue) backoffPod(pod *v1.Pod) {
p.podBackoff.Gc()
p.podBackoff.CleanupPodsCompletesBackingoff()
podID := nsNameForPod(pod)
boTime, found := p.podBackoff.GetBackoffTime(podID)