Commit 5f553a21 authored by Abhi Shah's avatar Abhi Shah

Merge pull request #21724 from freehan/imagepull

fix cascading backoff
parents b19102ba 973b01ee
......@@ -99,7 +99,7 @@ func (puller *imagePuller) PullImage(pod *api.Pod, container *api.Container, pul
}
}
backOffKey := fmt.Sprintf("%s_%s", pod.Name, container.Image)
backOffKey := fmt.Sprintf("%s_%s", pod.UID, container.Image)
if puller.backOff.IsInBackOffSinceUpdate(backOffKey, puller.backOff.Clock.Now()) {
msg := fmt.Sprintf("Back-off pulling image %q", container.Image)
puller.logIt(ref, api.EventTypeNormal, BackOffPullImage, logPrefix, msg, glog.Info)
......@@ -117,6 +117,7 @@ func (puller *imagePuller) PullImage(pod *api.Pod, container *api.Container, pul
}
}
puller.logIt(ref, api.EventTypeNormal, "Pulled", logPrefix, fmt.Sprintf("Successfully pulled image %q", container.Image), glog.Info)
puller.backOff.DeleteEntry(backOffKey)
puller.backOff.GC()
return nil, ""
}
......@@ -120,6 +120,12 @@ func (p *Backoff) GC() {
}
}
func (p *Backoff) DeleteEntry(id string) {
p.Lock()
defer p.Unlock()
delete(p.perItemBackoff, id)
}
// Take a lock on *Backoff, before calling initEntryUnsafe
func (p *Backoff) initEntryUnsafe(id string) *backoffEntry {
entry := &backoffEntry{backoff: p.defaultDuration}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment