@@ -1499,7 +1499,7 @@ func addProviderEndpointsToTranslateContext(tctx *provider.TranslateContext, c c
14991499 }
15001500 tctx .Services [serviceNN ] = & service
15011501
1502- return resolveServiceEndpoints (tctx , c , tctx , serviceNN , true , nil )
1502+ return resolveServiceEndpoints (tctx , c , serviceNN , true , nil )
15031503}
15041504
15051505func TypePredicate [T client.Object ]() func (obj client.Object ) bool {
@@ -1556,16 +1556,15 @@ func watchEndpointSliceOrEndpoints(bdr *ctrl.Builder, supportsEndpointSlice bool
15561556// resolveServiceEndpoints collects endpoints and adds them to the translate context
15571557// It handles both EndpointSlice (K8s 1.19+) and Endpoints (K8s 1.18) APIs with automatic fallback
15581558func resolveServiceEndpoints (
1559- ctx context.Context ,
1560- c client.Client ,
15611559 tctx * provider.TranslateContext ,
1560+ c client.Client ,
15621561 serviceNN k8stypes.NamespacedName ,
15631562 supportsEndpointSlice bool ,
15641563 subsetLabels map [string ]string ,
15651564) error {
15661565 if supportsEndpointSlice {
15671566 var endpoints discoveryv1.EndpointSliceList
1568- if err := c .List (ctx , & endpoints ,
1567+ if err := c .List (tctx , & endpoints ,
15691568 client .InNamespace (serviceNN .Namespace ),
15701569 client.MatchingLabels {
15711570 discoveryv1 .LabelServiceName : serviceNN .Name ,
@@ -1578,12 +1577,12 @@ func resolveServiceEndpoints(
15781577 tctx .EndpointSlices [serviceNN ] = endpoints .Items
15791578 } else {
15801579 // Apply subset filtering
1581- tctx .EndpointSlices [serviceNN ] = filterEndpointSlicesBySubsetLabels (ctx , c , endpoints .Items , subsetLabels )
1580+ tctx .EndpointSlices [serviceNN ] = filterEndpointSlicesBySubsetLabels (tctx , c , endpoints .Items , subsetLabels )
15821581 }
15831582 } else {
15841583 // Fallback to Endpoints API for Kubernetes 1.18 compatibility
15851584 var ep corev1.Endpoints
1586- if err := c .Get (ctx , serviceNN , & ep ); err != nil {
1585+ if err := c .Get (tctx , serviceNN , & ep ); err != nil {
15871586 if client .IgnoreNotFound (err ) != nil {
15881587 return fmt .Errorf ("failed to get endpoints: %v" , err )
15891588 }
@@ -1597,7 +1596,7 @@ func resolveServiceEndpoints(
15971596 tctx .EndpointSlices [serviceNN ] = convertedEndpointSlices
15981597 } else {
15991598 // Apply subset filtering to converted EndpointSlices
1600- tctx .EndpointSlices [serviceNN ] = filterEndpointSlicesBySubsetLabels (ctx , c , convertedEndpointSlices , subsetLabels )
1599+ tctx .EndpointSlices [serviceNN ] = filterEndpointSlicesBySubsetLabels (tctx , c , convertedEndpointSlices , subsetLabels )
16011600 }
16021601 }
16031602 }
0 commit comments