From 00bbfc04140a28bf2f4a739a792ec78f11ad1a36 Mon Sep 17 00:00:00 2001 From: Matias Manavella Date: Fri, 11 Sep 2020 10:20:39 -0300 Subject: [PATCH] Abort run collector on ImagePullBackoff --- pkg/collect/run.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/collect/run.go b/pkg/collect/run.go index 3c3bffb4..1c5c77ba 100644 --- a/pkg/collect/run.go +++ b/pkg/collect/run.go @@ -89,6 +89,13 @@ func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCo status.Status.Phase == corev1.PodSucceeded { break } + if status.Status.Phase == corev1.PodPending { + for k := range status.Status.ContainerStatuses { + if status.Status.ContainerStatuses[k].State.Waiting.Reason == "ImagePullBackOff" { + return nil, errors.Errorf("run pod aborted after getting pod status 'ImagePullBackOff'") + } + } + } time.Sleep(time.Second * 1) }