Skip to content

Commit

Permalink
fix index out of range (#3958)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian authored Apr 28, 2024
1 parent 4c50619 commit 7cddf7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/pinger/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func ParseFlags() (*Configuration, error) {
break
}

if pod.Status.ContainerStatuses[0].Ready {
util.LogFatalAndExit(nil, "failed to get IPs of Pod %s/%s", config.DaemonSetNamespace, podName)
if len(pod.Status.ContainerStatuses) != 0 && pod.Status.ContainerStatuses[0].Ready {
util.LogFatalAndExit(nil, "failed to get IPs of Pod %s/%s: podIPs is empty while the container is ready", config.DaemonSetNamespace, podName)
}

klog.Infof("cannot get Pod IPs now, waiting Pod to be ready")
Expand Down

0 comments on commit 7cddf7f

Please sign in to comment.