Skip to content

Commit 8f23e4e

Browse files
authored
[chore] check for pods len before accessing item 0 (#3628)
1 parent b4fa3d9 commit 8f23e4e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmd/gather/cluster/cluster.go

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ func (c *Cluster) GetOperatorLogs() error {
107107
return err
108108
}
109109

110+
if len(operatorPods.Items) == 0 {
111+
return errors.New("no operator pods found")
112+
}
113+
110114
pod := operatorPods.Items[0]
111115
c.getPodLogs(pod.Name, pod.Namespace, "manager")
112116
return nil

0 commit comments

Comments
 (0)