@@ -146,7 +146,7 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
146146 })
147147 genericConfig .BuildHandlerChainFunc = func (h http.Handler , conf * server.Config ) http.Handler {
148148 ex := mc.PathExtractor {PathPrefix : mcOpts .PathPrefix , ControlPlaneSegment : mcOpts .ControlPlaneSegment }
149- base := server .DefaultBuildHandlerChain (h , conf )
149+ base := withVersionOverride ( server .DefaultBuildHandlerChain (h , conf ) )
150150 dispatch := http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
151151 cid , _ , _ := mc .FromContext (r .Context ())
152152 if cid != "" && cid != mcOpts .DefaultCluster && crdRuntimeMgr != nil {
@@ -179,6 +179,8 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
179179 BaseLoopbackClientConfig : genericConfig .LoopbackClientConfig ,
180180 PathPrefix : mcOpts .PathPrefix ,
181181 ControlPlaneSegment : mcOpts .ControlPlaneSegment ,
182+ EtcdPrefix : storageFactory .StorageConfig .Prefix ,
183+ EtcdTransport : storageFactory .StorageConfig .Transport ,
182184 Authentication : opts .Authentication ,
183185 Authorization : opts .Authorization ,
184186 EgressSelector : genericConfig .EgressSelector ,
@@ -190,7 +192,9 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
190192 genericConfig .Authentication .Authenticator = mcauth .NewClusterAuthenticator (mcOpts .DefaultCluster , genericConfig .Authentication .Authenticator , authManager )
191193 }
192194 if genericConfig .Authorization .Authorizer != nil {
193- clusterAuthorizer := mcauth .NewClusterAuthorizer (mcOpts .DefaultCluster , genericConfig .Authorization .Authorizer , genericConfig .RuleResolver , authManager )
195+ // Route root and tenant authorization through the same multicluster
196+ // manager-backed path to avoid root-only stale lister divergence.
197+ clusterAuthorizer := mcauth .NewClusterAuthorizer (mcOpts .DefaultCluster , nil , nil , authManager )
194198 genericConfig .Authorization .Authorizer = clusterAuthorizer
195199 genericConfig .RuleResolver = clusterAuthorizer
196200 }
@@ -314,6 +318,9 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
314318 if apiExtensions .GenericConfig .RESTOptionsGetter != nil {
315319 apiExtensions .GenericConfig .RESTOptionsGetter = decorateRESTOptionsGetter ("apiextensions" , apiExtensions .GenericConfig .RESTOptionsGetter , mcOpts )
316320 }
321+ if apiExtensions .ExtraConfig .CRDRESTOptionsGetter != nil {
322+ apiExtensions .ExtraConfig .CRDRESTOptionsGetter = decorateRESTOptionsGetter ("apiextensions-crd" , apiExtensions .ExtraConfig .CRDRESTOptionsGetter , mcOpts )
323+ }
317324 apiExtensionsClientPool := mc .NewAPIExtensionsClientPool (apiExtensions .GenericConfig .LoopbackClientConfig , mcOpts .PathPrefix , mcOpts .ControlPlaneSegment )
318325 apiExtensionsInformerPool := mc .NewAPIExtensionsInformerPoolFromClientPool (apiExtensionsClientPool , 0 , genericConfig .DrainedNotify ())
319326 crdRuntimeMgr = mcbootstrap .NewCRDRuntimeManager (mcbootstrap.CRDRuntimeManagerOptions {
@@ -322,6 +329,8 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
322329 PathPrefix : mcOpts .PathPrefix ,
323330 ControlPlaneSegment : mcOpts .ControlPlaneSegment ,
324331 DefaultCluster : mcOpts .DefaultCluster ,
332+ EtcdPrefix : storageFactory .StorageConfig .Prefix ,
333+ EtcdTransport : storageFactory .StorageConfig .Transport ,
325334 })
326335 setCRDRequestResolvers (apiExtensions , crdRuntimeMgr .CRDGetterForRequest , crdRuntimeMgr .CRDListerForRequest )
327336 crdController := mcbootstrap .NewMulticlusterCRDController (crdRuntimeMgr , mcOpts .DefaultCluster )
@@ -364,7 +373,7 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
364373 // Ensure CRDs are also routed through the multicluster handler
365374 apiExtensions .GenericConfig .BuildHandlerChainFunc = func (h http.Handler , conf * server.Config ) http.Handler {
366375 ex := mc.PathExtractor {PathPrefix : mcOpts .PathPrefix , ControlPlaneSegment : mcOpts .ControlPlaneSegment }
367- base := server .DefaultBuildHandlerChain (h , conf )
376+ base := withVersionOverride ( server .DefaultBuildHandlerChain (h , conf ) )
368377 dispatch := http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
369378 cid , _ , _ := mc .FromContext (r .Context ())
370379 if cid != "" && cid != mcOpts .DefaultCluster {
@@ -381,11 +390,11 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
381390 mut := mca .NewMutating (mcOpts )
382391 val := mca .NewValidating (mcOpts )
383392 base := apiExtensions .GenericConfig .AdmissionControl
384- chain := []admission.Interface {mut , mcNamespaceLifecycle , mcMutatingWebhook }
393+ chain := []admission.Interface {mut , mcNamespaceLifecycle }
385394 if base != nil {
386395 chain = append (chain , base )
387396 }
388- chain = append (chain , mcValidatingWebhook , val )
397+ chain = append (chain , val )
389398 apiExtensions .GenericConfig .AdmissionControl = admission .NewChainHandler (chain ... )
390399 }
391400 c .ApiExtensions = apiExtensions
@@ -400,7 +409,7 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
400409 // Ensure aggregator also receives multicluster routing
401410 aggregator .GenericConfig .BuildHandlerChainFunc = func (h http.Handler , conf * server.Config ) http.Handler {
402411 ex := mc.PathExtractor {PathPrefix : mcOpts .PathPrefix , ControlPlaneSegment : mcOpts .ControlPlaneSegment }
403- base := server .DefaultBuildHandlerChain (h , conf )
412+ base := withVersionOverride ( server .DefaultBuildHandlerChain (h , conf ) )
404413 dispatch := http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
405414 cid , _ , _ := mc .FromContext (r .Context ())
406415 if cid != "" && cid != mcOpts .DefaultCluster && crdRuntimeMgr != nil {
@@ -417,11 +426,11 @@ func NewConfig(opts options.CompletedOptions) (*Config, error) {
417426 mut := mca .NewMutating (mcOpts )
418427 val := mca .NewValidating (mcOpts )
419428 base := aggregator .GenericConfig .AdmissionControl
420- chain := []admission.Interface {mut , mcNamespaceLifecycle , mcMutatingWebhook }
429+ chain := []admission.Interface {mut , mcNamespaceLifecycle }
421430 if base != nil {
422431 chain = append (chain , base )
423432 }
424- chain = append (chain , mcValidatingWebhook , val )
433+ chain = append (chain , val )
425434 aggregator .GenericConfig .AdmissionControl = admission .NewChainHandler (chain ... )
426435 }
427436 c .Aggregator = aggregator
0 commit comments