clean up BackOffImagePullErr
@@ -38,7 +38,7 @@ const (
crashLoopBackOff = "CrashLoopBackOff"
runContainerError = "RunContainerError"
imagePullErr = "ErrImagePull"
- errImagePullBackOff = "ErrImagePullBackOff"
+ imagePullBackOff = "ImagePullBackOff"
containerCreating = "ContainerCreating"
podKind = "pod"
)
@@ -203,13 +203,17 @@ func (p *podStatus) String() string {
func extractErrorMessageFromWaitingContainerStatus(c v1.ContainerStatus) (proto.StatusCode, error) {
// Extract meaning full error out of container statuses.
- switch c.State.Waiting.Reason {
+ r := c.State.Waiting.Reason
+ if strings.HasSuffix(r, imagePullBackOff) {
+ r = imagePullBackOff
+ }
+ switch r {
case containerCreating:
return proto.StatusCode_STATUSCHECK_CONTAINER_CREATING, fmt.Errorf("creating container %s", c.Name)
case crashLoopBackOff:
// TODO, in case of container restarting, return the original failure reason due to which container failed.
return proto.StatusCode_STATUSCHECK_CONTAINER_RESTARTING, fmt.Errorf("restarting failed container %s", c.Name)
- case imagePullErr, errImagePullBackOff:
+ case imagePullErr, imagePullBackOff:
return proto.StatusCode_STATUSCHECK_IMAGE_PULL_ERR, fmt.Errorf("container %s is waiting to start: %s can't be pulled", c.Name, c.Image)
case runContainerError:
match := runContainerRe.FindStringSubmatch(c.State.Waiting.Message)
