diff --git a/pkg/reconciler/workload/synctargetexports/synctargetexports_controller.go b/pkg/reconciler/workload/synctargetexports/synctargetexports_controller.go index cf455da4853..158bf79f94c 100644 --- a/pkg/reconciler/workload/synctargetexports/synctargetexports_controller.go +++ b/pkg/reconciler/workload/synctargetexports/synctargetexports_controller.go @@ -26,7 +26,6 @@ import ( "github.com/kcp-dev/logicalcluster/v3" "k8s.io/apimachinery/pkg/api/equality" - apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/errors" "k8s.io/apimachinery/pkg/util/runtime" @@ -77,18 +76,7 @@ func NewController( syncTargetLister: syncTargetInformer.Lister(), apiExportsIndexer: apiExportInformer.Informer().GetIndexer(), getAPIExport: func(path logicalcluster.Path, name string) (*apisv1alpha1.APIExport, error) { - // Try local informer first - export, err := indexers.ByPathAndName[*apisv1alpha1.APIExport](apisv1alpha1.Resource("apiexports"), apiExportInformer.Informer().GetIndexer(), path, name) - if err == nil { - // Quick happy path - found it locally - return export, nil - } - if !apierrors.IsNotFound(err) { - // Unrecoverable error - return nil, err - } - // Didn't find it locally - try remote - return indexers.ByPathAndName[*apisv1alpha1.APIExport](apisv1alpha1.Resource("apiexports"), globalAPIExportInformer.Informer().GetIndexer(), path, name) + return indexers.ByPathAndNameWithFallback[*apisv1alpha1.APIExport](apisv1alpha1.Resource("apiexports"), apiExportInformer.Informer().GetIndexer(), globalAPIExportInformer.Informer().GetIndexer(), path, name) }, getAPIResourceSchema: informer.NewScopedGetterWithFallback[*apisv1alpha1.APIResourceSchema, apisv1alpha1listers.APIResourceSchemaLister](apiResourceSchemaInformer.Lister(), globalAPIResourceSchemaInformer.Lister()), apiImportLister: apiResourceImportInformer.Lister(),