From 00bbfc04140a28bf2f4a739a792ec78f11ad1a36 Mon Sep 17 00:00:00 2001 From: Matias Manavella Date: Fri, 11 Sep 2020 10:20:39 -0300 Subject: [PATCH 1/2] 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) } From 2ae1b9b6786ae783d5c289203589e89459d2dbc9 Mon Sep 17 00:00:00 2001 From: Matias Manavella Date: Wed, 16 Sep 2020 18:16:32 -0300 Subject: [PATCH 2/2] abort run collector on ImagePullBackOff --- pkg/collect/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/collect/run.go b/pkg/collect/run.go index 1c5c77ba..578faab9 100644 --- a/pkg/collect/run.go +++ b/pkg/collect/run.go @@ -90,8 +90,8 @@ func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCo break } if status.Status.Phase == corev1.PodPending { - for k := range status.Status.ContainerStatuses { - if status.Status.ContainerStatuses[k].State.Waiting.Reason == "ImagePullBackOff" { + for _, v := range status.Status.ContainerStatuses { + if v.State.Waiting.Reason == "ImagePullBackOff" { return nil, errors.Errorf("run pod aborted after getting pod status 'ImagePullBackOff'") } }