From b2cb3bf43b6759b4376d6afc95be3b30ba7516f9 Mon Sep 17 00:00:00 2001 From: Salah Aldeen Al Saleh Date: Wed, 9 Sep 2020 07:41:34 -0700 Subject: [PATCH] handle nil ImagePullSecret in collector (#255) --- pkg/collect/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/collect/run.go b/pkg/collect/run.go index 0025e0038..3c3bffb44 100644 --- a/pkg/collect/run.go +++ b/pkg/collect/run.go @@ -34,7 +34,7 @@ func Run(c *Collector, runCollector *troubleshootv1beta2.Run) (map[string][]byte logger.Printf("Failed to delete pod %s: %v\n", pod.Name, err) } }() - if runCollector.ImagePullSecret.Data != nil { + if runCollector.ImagePullSecret != nil && runCollector.ImagePullSecret.Data != nil { defer func() { for _, k := range pod.Spec.ImagePullSecrets { if err := client.CoreV1().Secrets(pod.Namespace).Delete(ctx, k.Name, metav1.DeleteOptions{}); err != nil {