From db7ea0c69e9b40a33a32eebab5b62e9a4c7b46e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Sun, 28 Apr 2024 12:54:40 +0800 Subject: [PATCH] fix index out of range (#3958) Signed-off-by: zhangzujian --- pkg/pinger/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/pinger/config.go b/pkg/pinger/config.go index 61de6ba273e..44046f4dde9 100644 --- a/pkg/pinger/config.go +++ b/pkg/pinger/config.go @@ -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")