From 0d84ab50b5bd0648327f41f20a5c460cd104aedd Mon Sep 17 00:00:00 2001 From: Tomas Hulata Date: Thu, 13 Oct 2022 02:11:00 +0200 Subject: [PATCH] fix ports (#9149) --- internal/ingress/controller/endpointslices.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ingress/controller/endpointslices.go b/internal/ingress/controller/endpointslices.go index efd2a6afa1..5a24c38801 100644 --- a/internal/ingress/controller/endpointslices.go +++ b/internal/ingress/controller/endpointslices.go @@ -84,8 +84,8 @@ func getEndpointsFromSlices(s *corev1.Service, port *corev1.ServicePort, proto c // loop over all endpointSlices generated for service for _, eps := range epss { var ports []int32 - if len(eps.Ports) == 0 { - // When ports is empty, it indicates that there are no defined ports, using svc targePort <- this could be wrong + if len(eps.Ports) == 0 && port.TargetPort.Type == intstr.Int { + // When ports is empty, it indicates that there are no defined ports, using svc targePort if it's a number klog.V(3).Infof("No ports found on endpointSlice, using service TargetPort %v for Service %q", port.String(), svcKey) ports = append(ports, port.TargetPort.IntVal) } else {