@@ -171,7 +171,7 @@ func runWithoutTimeout(ctx context.Context, bundlePath string, clientConfig *res
171171 }
172172 if status .Status .Phase == corev1 .PodPending {
173173 for _ , v := range status .Status .ContainerStatuses {
174- if v .State .Waiting != nil && v .State .Waiting .Reason == "ImagePullBackOff" {
174+ if v .State .Waiting != nil && v .State .Waiting .Reason == "ImagePullBackOff" && ! runPodCollector . AllowImagePullRetries {
175175 return nil , errors .Errorf ("run pod aborted after getting pod status 'ImagePullBackOff'" )
176176 }
177177
@@ -355,6 +355,11 @@ func RunPodsReadyNodes(ctx context.Context, client v1.CoreV1Interface, opts RunP
355355
356356// RunPodLogs runs a pod to completion on a node and returns its logs
357357func RunPodLogs (ctx context.Context , client v1.CoreV1Interface , podSpec * corev1.Pod ) ([]byte , error ) {
358+ return RunPodLogsWithOptions (ctx , client , podSpec , false )
359+ }
360+
361+ // RunPodLogsWithOptions runs a pod to completion on a node and returns its logs with configurable options
362+ func RunPodLogsWithOptions (ctx context.Context , client v1.CoreV1Interface , podSpec * corev1.Pod , allowImagePullRetries bool ) ([]byte , error ) {
358363 // 1. Create
359364 pod , err := client .Pods (podSpec .Namespace ).Create (ctx , podSpec , metav1.CreateOptions {})
360365 if err != nil {
@@ -380,7 +385,7 @@ func RunPodLogs(ctx context.Context, client v1.CoreV1Interface, podSpec *corev1.
380385
381386 if pod .Status .Phase == corev1 .PodPending {
382387 for _ , v := range pod .Status .ContainerStatuses {
383- if v .State .Waiting != nil && v .State .Waiting .Reason == "ImagePullBackOff" {
388+ if v .State .Waiting != nil && v .State .Waiting .Reason == "ImagePullBackOff" && ! allowImagePullRetries {
384389 return nil , errors .New ("wait for pod aborted after getting pod status 'ImagePullBackOff'" )
385390 }
386391 }
0 commit comments