From c701a42ce2e03c0dc18eea20449ef48d091192c8 Mon Sep 17 00:00:00 2001 From: Renjie Cai Date: Wed, 20 Nov 2024 08:22:33 +0800 Subject: [PATCH] fix: use target namespace to get pod info from repo (#3914) --- pkg/backend/endpoint_resolver.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/backend/endpoint_resolver.go b/pkg/backend/endpoint_resolver.go index 507ac16ca..55d7a50f6 100644 --- a/pkg/backend/endpoint_resolver.go +++ b/pkg/backend/endpoint_resolver.go @@ -160,7 +160,11 @@ func (r *defaultEndpointResolver) resolvePodEndpointsWithEndpointsData(ctx conte } epAddr := ep.Addresses[0] - podKey := types.NamespacedName{Namespace: svcKey.Namespace, Name: ep.TargetRef.Name} + podNamespace := svcKey.Namespace + if ep.TargetRef.Namespace != "" { + podNamespace = ep.TargetRef.Namespace + } + podKey := types.NamespacedName{Namespace: podNamespace, Name: ep.TargetRef.Name} pod, exists, err := r.podInfoRepo.Get(ctx, podKey) if err != nil { return nil, false, err