@@ -79,6 +79,7 @@ import (
7979 coresreplicateclusterrole "github.com/kcp-dev/kcp/pkg/reconciler/core/replicateclusterrole"
8080 corereplicateclusterrolebinding "github.com/kcp-dev/kcp/pkg/reconciler/core/replicateclusterrolebinding"
8181 "github.com/kcp-dev/kcp/pkg/reconciler/core/shard"
82+ "github.com/kcp-dev/kcp/pkg/reconciler/dynamicrestmapper"
8283 "github.com/kcp-dev/kcp/pkg/reconciler/garbagecollector"
8384 "github.com/kcp-dev/kcp/pkg/reconciler/kubequota"
8485 "github.com/kcp-dev/kcp/pkg/reconciler/tenancy/bootstrap"
@@ -1595,6 +1596,39 @@ func (s *Server) installGarbageCollectorController(ctx context.Context, config *
15951596 })
15961597}
15971598
1599+ func (s * Server ) installDynamicRESTMapper (ctx context.Context , config * rest.Config ) error {
1600+ c , err := dynamicrestmapper .NewController (ctx , s .DynRESTMapper ,
1601+ s .ApiExtensionsSharedInformerFactory .Apiextensions ().V1 ().CustomResourceDefinitions (),
1602+ s .KcpSharedInformerFactory .Apis ().V1alpha1 ().APIBindings (),
1603+ s .KcpSharedInformerFactory .Apis ().V1alpha2 ().APIExports (),
1604+ s .KcpSharedInformerFactory .Apis ().V1alpha1 ().APIResourceSchemas (),
1605+ s .CacheKcpSharedInformerFactory .Apis ().V1alpha2 ().APIExports (),
1606+ s .CacheKcpSharedInformerFactory .Apis ().V1alpha1 ().APIResourceSchemas (),
1607+ s .KcpSharedInformerFactory .Core ().V1alpha1 ().LogicalClusters (),
1608+ )
1609+ if err != nil {
1610+ return err
1611+ }
1612+
1613+ return s .registerController (& controllerWrapper {
1614+ Name : dynamicrestmapper .ControllerName ,
1615+ Wait : func (ctx context.Context , s * Server ) error {
1616+ return wait .PollUntilContextCancel (ctx , waitPollInterval , true , func (ctx context.Context ) (bool , error ) {
1617+ return s .KcpSharedInformerFactory .Core ().V1alpha1 ().LogicalClusters ().Informer ().HasSynced () &&
1618+ s .ApiExtensionsSharedInformerFactory .Apiextensions ().V1 ().CustomResourceDefinitions ().Informer ().HasSynced () &&
1619+ s .KcpSharedInformerFactory .Apis ().V1alpha2 ().APIExports ().Informer ().HasSynced () &&
1620+ s .CacheKcpSharedInformerFactory .Apis ().V1alpha2 ().APIExports ().Informer ().HasSynced () &&
1621+ s .KcpSharedInformerFactory .Apis ().V1alpha1 ().APIResourceSchemas ().Informer ().HasSynced () &&
1622+ s .CacheKcpSharedInformerFactory .Apis ().V1alpha1 ().APIResourceSchemas ().Informer ().HasSynced () &&
1623+ s .KcpSharedInformerFactory .Apis ().V1alpha1 ().APIBindings ().Informer ().HasSynced (), nil
1624+ })
1625+ },
1626+ Runner : func (ctx context.Context ) {
1627+ c .Start (ctx , 2 )
1628+ },
1629+ })
1630+ }
1631+
15981632func (s * Server ) WaitForSync (stop <- chan struct {}) error {
15991633 // Wait for shared informer factories to by synced.
16001634 // factory. Otherwise, informer list calls may go into backoff (before the CRDs are ready) and
0 commit comments