Skip to content

Commit

Permalink
Merge pull request kubernetes#3302 from lavalamp/fix
Browse files Browse the repository at this point in the history
reuse function; never ever unlock without defer
  • Loading branch information
brendandburns committed Jan 8, 2015
2 parents fbda9f4 + 95dd2d7 commit a19bb1b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a19bb1b

Please sign in to comment.