Skip to content

Commit

Permalink
fix potential panic
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterYan committed Nov 5, 2024
1 parent 8db2e3e commit 65f15bf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/supportbundle/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,16 @@ func runRemoteHostCollectors(ctx context.Context, hostCollectors []*troubleshoot
// TODO:
// delete the config map
// delete the remote pods
clientset.AppsV1().DaemonSets(ds.Namespace).Delete(ctx, ds.Name, metav1.DeleteOptions{})
// check if the daemonset still exists
_, err := clientset.AppsV1().DaemonSets(ds.Namespace).Get(ctx, ds.Name, metav1.GetOptions{})
if err != nil {
klog.Errorf("Failed to verify remote host collector daemonset %s still exists: %v", ds.Name, err)
return
}

if err := clientset.AppsV1().DaemonSets(ds.Namespace).Delete(ctx, ds.Name, metav1.DeleteOptions{}); err != nil {
klog.Errorf("Failed to delete remote host collector daemonset %s: %v", ds.Name, err)
}
}()

for node, logs := range nodeLogs {
Expand Down

0 comments on commit 65f15bf

Please sign in to comment.