Merge pull request #14182 from jiangyaoguo/distinguish-registry-unavailable-and-pull-failure

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-10-16 16:22:22 -07:00
4 changed files with 11 additions and 3 deletions

View File

@@ -105,7 +105,12 @@ func (puller *imagePuller) PullImage(pod *api.Pod, container *api.Container, pul
if err = puller.runtime.PullImage(spec, pullSecrets); err != nil {
puller.logIt(ref, "Failed", logPrefix, fmt.Sprintf("Failed to pull image %q: %v", container.Image, err), glog.Warning)
puller.backOff.Next(backOffKey, puller.backOff.Clock.Now())
return ErrImagePull, err.Error()
if err == RegistryUnavailable {
msg := fmt.Sprintf("image pull failed for %s because the registry is temporarily unavailable.", container.Image)
return err, msg
} else {
return ErrImagePull, err.Error()
}
}
puller.logIt(ref, "Pulled", logPrefix, fmt.Sprintf("Successfully pulled image %q", container.Image), glog.Info)
puller.backOff.GC()

View File

@@ -45,6 +45,9 @@ var (
// Required Image is absent on host and PullPolicy is NeverPullImage
ErrImageNeverPull = errors.New("ErrImageNeverPull")
// Get http error when pulling image from registry
RegistryUnavailable = errors.New("RegistryUnavailable")
)
var ErrRunContainer = errors.New("RunContainerError")