From 58baa38fbf15862193f5ad64f54607e43ffaa94c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Fri, 24 Nov 2023 18:19:36 +0800 Subject: [PATCH] kube-ovn-cni: fix pinger result when timeout is reached (#3457) Signed-off-by: zhangzujian --- pkg/daemon/ovs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/daemon/ovs.go b/pkg/daemon/ovs.go index 43e521df6622..e6d62d803da3 100644 --- a/pkg/daemon/ovs.go +++ b/pkg/daemon/ovs.go @@ -32,6 +32,11 @@ func pingGateway(gw, src string, verbose bool, maxRetry int) error { } pinger.Run() + if pinger.PacketsRecv == 0 { + klog.Warningf("%s network not ready after %d ping, gw %s", src, pinger.PacketsSent, gw) + return pinger.PacketsSent, fmt.Errorf("no packets received from gateway %s", gw) + } + cniConnectivityResult.WithLabelValues(nodeName).Add(float64(pinger.PacketsSent)) if !success { return fmt.Errorf("%s network not ready after %d ping %s", src, maxRetry, gw)