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 <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed Apr 28, 2024
1 parent bfe8033 commit db7ea0c
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 db7ea0c

Please sign in to comment.