do not transform the error string
@@ -39,6 +39,7 @@ const (
runContainerError = "RunContainerError"
imagePullErr = "ErrImagePull"
imagePullBackOff = "ImagePullBackOff"
+ errImagePullBackOff = "ErrImagePullBackOff"
containerCreating = "ContainerCreating"
podKind = "pod"
)
@@ -202,18 +203,14 @@ func (p *podStatus) String() string {
}
func extractErrorMessageFromWaitingContainerStatus(c v1.ContainerStatus) (proto.StatusCode, error) {
- r := c.State.Waiting.Reason
- if strings.HasSuffix(r, imagePullBackOff) {
- r = imagePullBackOff
- }
- switch r {
+ switch c.State.Waiting.Reason {
// Extract meaning full error out of container statuses.
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, imagePullBackOff:
+ case imagePullErr, imagePullBackOff, errImagePullBackOff:
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)
