Merge pull request #3264 from brendandburns/race

Add a lock around the other docker pull.
This commit is contained in:
Tim Hockin 2015-01-07 09:54:47 -08:00
commit 512e262dc8

View File

@ -905,14 +905,17 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
}
if api.IsPullAlways(container.ImagePullPolicy) ||
(api.IsPullIfNotPresent(container.ImagePullPolicy) && (!present || latest)) {
kl.pullLock.RLock()
if err := kl.dockerPuller.Pull(container.Image); err != nil {
if ref != nil {
record.Eventf(ref, "failed", "failed", "Failed to pull image %q", container.Image)
}
glog.Errorf("Failed to pull image %q: %v; skipping pod %q container %q.", container.Image, err, podFullName, container.Name)
kl.pullLock.RUnlock()
continue
}
kl.pullLock.RUnlock()
if ref != nil {
record.Eventf(ref, "waiting", "pulled", "Successfully pulled image %q", container.Image)
}