Skip to content

Commit 499dbf5

Browse files
authored
fix ports (#9149)
1 parent e53d19c commit 499dbf5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/ingress/controller/endpointslices.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ func getEndpointsFromSlices(s *corev1.Service, port *corev1.ServicePort, proto c
8484
// loop over all endpointSlices generated for service
8585
for _, eps := range epss {
8686
var ports []int32
87-
if len(eps.Ports) == 0 {
88-
// When ports is empty, it indicates that there are no defined ports, using svc targePort <- this could be wrong
87+
if len(eps.Ports) == 0 && port.TargetPort.Type == intstr.Int {
88+
// When ports is empty, it indicates that there are no defined ports, using svc targePort if it's a number
8989
klog.V(3).Infof("No ports found on endpointSlice, using service TargetPort %v for Service %q", port.String(), svcKey)
9090
ports = append(ports, port.TargetPort.IntVal)
9191
} else {

0 commit comments

Comments
 (0)