@@ -137,6 +137,9 @@ type Config struct {
137
137
// RequestContextMapper maps requests to contexts. Exported so downstream consumers can provider their own mappers
138
138
// TODO confirm that anyone downstream actually uses this and doesn't just need an accessor
139
139
RequestContextMapper apirequest.RequestContextMapper
140
+ // RequestInfoResolver is used to assign attributes (used by admission and authorization) based on a request URL.
141
+ // Use-cases that are like kubelets may need to customize this.
142
+ RequestInfoResolver apirequest.RequestInfoResolver
140
143
// Serializer is required and provides the interface for serializing and converting objects to and from the wire
141
144
// The default (api.Codecs) usually works fine.
142
145
Serializer runtime.NegotiatedSerializer
@@ -364,6 +367,10 @@ func (c *Config) Complete() completedConfig {
364
367
c .Authorizer = authorizerunion .New (tokenAuthorizer , c .Authorizer )
365
368
}
366
369
370
+ if c .RequestInfoResolver == nil {
371
+ c .RequestInfoResolver = NewRequestInfoResolver (c )
372
+ }
373
+
367
374
return completedConfig {c }
368
375
}
369
376
@@ -477,7 +484,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) http.Handler {
477
484
handler = genericfilters .WithCORS (handler , c .CorsAllowedOriginList , nil , nil , nil , "true" )
478
485
handler = genericfilters .WithPanicRecovery (handler )
479
486
handler = genericfilters .WithTimeoutForNonLongRunningRequests (handler , c .RequestContextMapper , c .LongRunningFunc , c .RequestTimeout )
480
- handler = genericapifilters .WithRequestInfo (handler , NewRequestInfoResolver ( c ) , c .RequestContextMapper )
487
+ handler = genericapifilters .WithRequestInfo (handler , c . RequestInfoResolver , c .RequestContextMapper )
481
488
handler = apirequest .WithRequestContext (handler , c .RequestContextMapper )
482
489
return handler
483
490
}
0 commit comments