From 853845ace2d5976068e4d743ff2703fe149ed286 Mon Sep 17 00:00:00 2001 From: Lavanya Sirigudi <65212197+lavanya-f5@users.noreply.github.com> Date: Fri, 23 Sep 2022 14:27:30 +0530 Subject: [PATCH] Fix svcPort support (#2599) --- pkg/controller/resourceConfig.go | 4 ++-- pkg/controller/worker.go | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/controller/resourceConfig.go b/pkg/controller/resourceConfig.go index 25b2c5e7f..40e020852 100644 --- a/pkg/controller/resourceConfig.go +++ b/pkg/controller/resourceConfig.go @@ -426,10 +426,10 @@ func (ctlr *Controller) prepareRSConfigFromVirtualServer( continue } framedPools[poolName] = struct{}{} - targetPort := intstr.IntOrString{IntVal: pl.ServicePort} + targetPort := ctlr.fetchTargetPort(vs.Namespace, pl.Service, pl.ServicePort) if (intstr.IntOrString{}) == targetPort { - targetPort = ctlr.fetchTargetPort(vs.Namespace, pl.Service, pl.ServicePort) + targetPort = intstr.IntOrString{IntVal: pl.ServicePort} } svcNamespace := vs.Namespace if pl.ServiceNamespace != "" { diff --git a/pkg/controller/worker.go b/pkg/controller/worker.go index f53a8fcd9..15c103f3d 100644 --- a/pkg/controller/worker.go +++ b/pkg/controller/worker.go @@ -1518,6 +1518,10 @@ func (ctlr *Controller) updatePoolMembersForNodePort( ctlr.getEndpointsForNodePort(svcPort.NodePort, pool.NodeMemberLabel) } } + //check if endpoints are found + if rsCfg.Pools[index].Members == nil { + log.Errorf("[CORE]Endpoints could not be fetched for service %v with targetPort %v", svcName, pool.ServicePort.IntVal) + } } } @@ -1545,6 +1549,10 @@ func (ctlr *Controller) updatePoolMembersForCluster( rsCfg.MetaData.Active = true rsCfg.Pools[index].Members = mems } + //check if endpoints are found + if rsCfg.Pools[index].Members == nil { + log.Errorf("[CORE]Endpoints could not be fetched for service %v with targetPort %v", svcName, pool.ServicePort.IntVal) + } } }