Skip to content

Commit 9883056

Browse files
committed
[chore] check for pods len before accessing item 0
1 parent a36367b commit 9883056

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/gather/cluster/cluster.go

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package cluster
1616

1717
import (
1818
"context"
19+
"errors"
1920
"fmt"
2021
"log"
2122
"os"
@@ -104,6 +105,10 @@ func (c *Cluster) GetOperatorLogs() error {
104105
return err
105106
}
106107

108+
if len(operatorPods.Items) == 0 {
109+
return errors.New("no operator pods found")
110+
}
111+
107112
pod := operatorPods.Items[0]
108113
c.getPodLogs(pod.Name, pod.Namespace, "manager")
109114
return nil

0 commit comments

Comments
 (0)