From 6e29dd5ca51b0d6a60fd8dd26beb18d6f0082da1 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Wed, 18 Sep 2024 10:52:35 +0200 Subject: [PATCH] reconciler/apibinding: filter by cluster through index, not manually Signed-off-by: Dr. Stefan Schimanski --- .../apis/apibinding/apibinding_controller.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/pkg/reconciler/apis/apibinding/apibinding_controller.go b/pkg/reconciler/apis/apibinding/apibinding_controller.go index 548eb34d465..90f3b680804 100644 --- a/pkg/reconciler/apis/apibinding/apibinding_controller.go +++ b/pkg/reconciler/apis/apibinding/apibinding_controller.go @@ -82,22 +82,7 @@ func NewController( kcpClusterClient: kcpClusterClient, listAPIBindings: func(clusterName logicalcluster.Name) ([]*apisv1alpha1.APIBinding, error) { - list, err := apiBindingInformer.Lister().List(labels.Everything()) - if err != nil { - return nil, err - } - - var ret []*apisv1alpha1.APIBinding - - for i := range list { - if logicalcluster.From(list[i]) != clusterName { - continue - } - - ret = append(ret, list[i]) - } - - return ret, nil + return apiBindingInformer.Lister().Cluster(clusterName).List(labels.Everything()) }, listAPIBindingsByAPIExport: func(export *apisv1alpha1.APIExport) ([]*apisv1alpha1.APIBinding, error) { // binding keys by full path