mirror of https://github.com/k3s-io/k3s
Merge pull request #3302 from lavalamp/fix
reuse function; never ever unlock without deferpull/6/head
commit
a19bb1bd29
|
@ -739,6 +739,9 @@ func (kl *Kubelet) pullImage(img string, ref *api.ObjectReference) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
if ref != nil {
|
||||
record.Eventf(ref, "waiting", "pulled", "Successfully pulled image %q", img)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -905,20 +908,9 @@ 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()
|
||||
if err := kl.pullImage(container.Image, ref); err != nil {
|
||||
continue
|
||||
}
|
||||
kl.pullLock.RUnlock()
|
||||
if ref != nil {
|
||||
record.Eventf(ref, "waiting", "pulled", "Successfully pulled image %q", container.Image)
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO(dawnchen): Check RestartPolicy.DelaySeconds before restart a container
|
||||
|
|
Loading…
Reference in New Issue