Skip to content

Commit cd21356

Browse files
atoulmeElfoLiNk
authored andcommitted
[chore] check for pods len before accessing item 0 (open-telemetry#3628)
1 parent cef7bca commit cd21356

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)