Skip to content

Commit cc7fc96

Browse files
committed
nil pointer fix. make bundle after timeot
1 parent 091f9f9 commit cc7fc96

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/troubleshoot/cli/run_nocrd.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
210210
collectorDirs = append(collectorDirs, collectorDir)
211211

212212
if err := client.Delete(context.Background(), newPod); err != nil {
213-
fmt.Println("delete pod")
213+
fmt.Println("delete pod error", err)
214214
}
215215
podsDeleted = append(podsDeleted, newPod)
216216
},
@@ -225,7 +225,8 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
225225
fmt.Printf("creating collector\n")
226226
_, pod, err := collectrunner.CreateCollector(client, s, &owner, collector.Name, v.GetString("namespace"), serviceAccountName, "troubleshoot", collect, v.GetString("image"), v.GetString("pullpolicy"))
227227
if err != nil {
228-
return "", err
228+
fmt.Printf("A collector pod cannot be created: %v\n", err)
229+
continue
229230
}
230231
podsCreated = append(podsCreated, pod)
231232
}

pkg/collect/runner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ func createCollectorPod(client client.Client, scheme *runtime.Scheme, ownerRef m
8989

9090
found := &corev1.Pod{}
9191
err := client.Get(context.Background(), namespacedName, found)
92-
if err == nil || !kuberneteserrors.IsNotFound(err) {
92+
if err == nil {
93+
return nil, fmt.Errorf("pod %q already exists", name)
94+
} else if !kuberneteserrors.IsNotFound(err) {
9395
return nil, err
9496
}
9597

0 commit comments

Comments
 (0)