Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer fix. make bundle after timeout #24

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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