@@ -614,7 +614,7 @@ func (r *gatewayAPIReconciler) validateEndpointSliceForReconcile(obj client.Obje
614614 }
615615 }
616616
617- if r .isProxyServiceCluster (& nsName ) {
617+ if r .isProxyServiceCluster (ep . GetLabels () ) {
618618 return true
619619 }
620620 return false
@@ -940,23 +940,13 @@ func (r *gatewayAPIReconciler) isRouteReferencingHTTPRouteFilter(nsName *types.N
940940 return len (httpRouteList .Items ) != 0
941941}
942942
943- func (r * gatewayAPIReconciler ) isProxyServiceCluster (nn * types.NamespacedName ) bool {
944- ctx := context .Background ()
945- svc := & corev1.Service {}
946- if err := r .client .Get (ctx , * nn , svc ); err != nil {
947- r .log .Error (err , "unable to find associated proxy ServiceCluster" )
948- return false
949- }
950-
951- svcLabels := svc .GetLabels ()
952-
953- // Check if service belongs to a Gateway
954- if gtw := r .findOwningGateway (ctx , svcLabels ); gtw != nil {
943+ // isProxyServiceCluster returns true if the provided labels reference an owning Gateway or GatewayClass
944+ func (r * gatewayAPIReconciler ) isProxyServiceCluster (labels map [string ]string ) bool {
945+ if gtw := r .findOwningGateway (context .Background (), labels ); gtw != nil {
955946 return true
956947 }
957948
958- // Check if service belongs to a GatewayClass
959- gcName , ok := svcLabels [gatewayapi .OwningGatewayClassLabel ]
949+ gcName , ok := labels [gatewayapi .OwningGatewayClassLabel ]
960950 if ok && r .mergeGateways .Has (gcName ) {
961951 return true
962952 }
0 commit comments