Don't panic when pod is in a waiting state

This commit is contained in:
divolgin
2020-10-06 00:24:46 +00:00
parent 446b1d5552
commit 3d301f4307
+1 -1
View File
@@ -90,7 +90,7 @@ func runWithoutTimeout(ctx context.Context, c *Collector, pod *corev1.Pod, runCo
}
if status.Status.Phase == corev1.PodPending {
for _, v := range status.Status.ContainerStatuses {
if v.State.Waiting.Reason == "ImagePullBackOff" {
if v.State.Waiting != nil && v.State.Waiting.Reason == "ImagePullBackOff" {
return nil, errors.Errorf("run pod aborted after getting pod status 'ImagePullBackOff'")
}
}