diff --git a/internal/k8s/controller.go b/internal/k8s/controller.go index 5dfd1dadc..a518ec013 100644 --- a/internal/k8s/controller.go +++ b/internal/k8s/controller.go @@ -3009,7 +3009,7 @@ func getEndpointsFromEndpointSlicesForSubselectedPods(targetPort int32, pods []* } } } - return maps.Keys(endpointSet) + return slices.Collect(maps.Keys(endpointSet)) } return makePodEndpoints(pods, filterReadyEndpointsFrom(selectEndpointSlicesForPort(targetPort, svcEndpointSlices))) diff --git a/internal/k8s/controller_test.go b/internal/k8s/controller_test.go index c76a230ee..31458504f 100644 --- a/internal/k8s/controller_test.go +++ b/internal/k8s/controller_test.go @@ -1227,7 +1227,7 @@ func TestGetEndpointSlicesBySubselectedPods_GetsEndpointsOnNilValues(t *testing. { desc: "no endpoints selected on nil endpoint port", targetPort: 8080, - want: []podEndpoint{}, + want: nil, pods: []*api_v1.Pod{ { ObjectMeta: meta_v1.ObjectMeta{ @@ -1267,7 +1267,7 @@ func TestGetEndpointSlicesBySubselectedPods_GetsEndpointsOnNilValues(t *testing. { desc: "no endpoints selected on nil endpoint condition", targetPort: 8080, - want: []podEndpoint{}, + want: nil, pods: []*api_v1.Pod{ { ObjectMeta: meta_v1.ObjectMeta{