Skip to content

Commit

Permalink
nil pointer fix. make bundle after timeot
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Jul 24, 2019
1 parent 091f9f9 commit cc7fc96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/troubleshoot/cli/run_nocrd.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
collectorDirs = append(collectorDirs, collectorDir)

if err := client.Delete(context.Background(), newPod); err != nil {
fmt.Println("delete pod")
fmt.Println("delete pod error", err)
}
podsDeleted = append(podsDeleted, newPod)
},
Expand All @@ -225,7 +225,8 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
fmt.Printf("creating collector\n")
_, pod, err := collectrunner.CreateCollector(client, s, &owner, collector.Name, v.GetString("namespace"), serviceAccountName, "troubleshoot", collect, v.GetString("image"), v.GetString("pullpolicy"))
if err != nil {
return "", err
fmt.Printf("A collector pod cannot be created: %v\n", err)
continue
}
podsCreated = append(podsCreated, pod)
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/collect/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ func createCollectorPod(client client.Client, scheme *runtime.Scheme, ownerRef m

found := &corev1.Pod{}
err := client.Get(context.Background(), namespacedName, found)
if err == nil || !kuberneteserrors.IsNotFound(err) {
if err == nil {
return nil, fmt.Errorf("pod %q already exists", name)
} else if !kuberneteserrors.IsNotFound(err) {
return nil, err
}

Expand Down

0 comments on commit cc7fc96

Please sign in to comment.