From 2ac2bc8d86857532703dcc50ac7aca1200a32557 Mon Sep 17 00:00:00 2001 From: Olaf Klischat Date: Fri, 5 Apr 2024 00:56:16 +0200 Subject: [PATCH] connectivity test: avoid segfault if no agent pods are found Signed-off-by: Olaf Klischat --- connectivity/check/context.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connectivity/check/context.go b/connectivity/check/context.go index abf08ce6f4..0ca8a0bca7 100644 --- a/connectivity/check/context.go +++ b/connectivity/check/context.go @@ -853,6 +853,9 @@ func (ct *ConnectivityTest) initCiliumPods(ctx context.Context) error { if err != nil { return fmt.Errorf("unable to list Cilium pods: %w", err) } + if len(ciliumPods.Items) == 0 { + return fmt.Errorf("no cilium agent pods found in -n %s -l %s", ct.params.CiliumNamespace, ct.params.AgentPodSelector) + } for _, ciliumPod := range ciliumPods.Items { // TODO: Can Cilium pod names collide across clusters? ct.ciliumPods[ciliumPod.Name] = Pod{