Merge pull request #50864 from mbohlool/update_openapi_aggr
Automatic merge from submit-queue Improvements to OpenAPI aggregation Fixes #50863 Fixes #50011 Related: #50896 Kubernetes-commit: 75e111ad8713835161ac56e7fd95cdeb51b2f9ad
This commit is contained in:
		
						commit
						d2421c64dc
					
				|  | @ -405,6 +405,7 @@ func (c completedConfig) New(name string, delegationTarget DelegationTarget) (*G | ||||||
| 		requestContextMapper:   c.RequestContextMapper, | 		requestContextMapper:   c.RequestContextMapper, | ||||||
| 		Serializer:             c.Serializer, | 		Serializer:             c.Serializer, | ||||||
| 		AuditBackend:           c.AuditBackend, | 		AuditBackend:           c.AuditBackend, | ||||||
|  | 		delegationTarget:       delegationTarget, | ||||||
| 
 | 
 | ||||||
| 		minRequestTimeout: time.Duration(c.MinRequestTimeout) * time.Second, | 		minRequestTimeout: time.Duration(c.MinRequestTimeout) * time.Second, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -145,6 +145,9 @@ type GenericAPIServer struct { | ||||||
| 	// enableAPIResponseCompression indicates whether API Responses should support compression
 | 	// enableAPIResponseCompression indicates whether API Responses should support compression
 | ||||||
| 	// if the client requests it via Accept-Encoding
 | 	// if the client requests it via Accept-Encoding
 | ||||||
| 	enableAPIResponseCompression bool | 	enableAPIResponseCompression bool | ||||||
|  | 
 | ||||||
|  | 	// delegationTarget is the next delegate in the chain or nil
 | ||||||
|  | 	delegationTarget DelegationTarget | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // DelegationTarget is an interface which allows for composition of API servers with top level handling that works
 | // DelegationTarget is an interface which allows for composition of API servers with top level handling that works
 | ||||||
|  | @ -165,6 +168,9 @@ type DelegationTarget interface { | ||||||
| 
 | 
 | ||||||
| 	// ListedPaths returns the paths for supporting an index
 | 	// ListedPaths returns the paths for supporting an index
 | ||||||
| 	ListedPaths() []string | 	ListedPaths() []string | ||||||
|  | 
 | ||||||
|  | 	// NextDelegate returns the next delegationTarget in the chain of delegations
 | ||||||
|  | 	NextDelegate() DelegationTarget | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (s *GenericAPIServer) UnprotectedHandler() http.Handler { | func (s *GenericAPIServer) UnprotectedHandler() http.Handler { | ||||||
|  | @ -181,6 +187,10 @@ func (s *GenericAPIServer) ListedPaths() []string { | ||||||
| 	return s.listedPathProvider.ListedPaths() | 	return s.listedPathProvider.ListedPaths() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func (s *GenericAPIServer) NextDelegate() DelegationTarget { | ||||||
|  | 	return s.delegationTarget | ||||||
|  | } | ||||||
|  | 
 | ||||||
| var EmptyDelegate = emptyDelegate{ | var EmptyDelegate = emptyDelegate{ | ||||||
| 	requestContextMapper: apirequest.NewRequestContextMapper(), | 	requestContextMapper: apirequest.NewRequestContextMapper(), | ||||||
| } | } | ||||||
|  | @ -204,6 +214,9 @@ func (s emptyDelegate) ListedPaths() []string { | ||||||
| func (s emptyDelegate) RequestContextMapper() apirequest.RequestContextMapper { | func (s emptyDelegate) RequestContextMapper() apirequest.RequestContextMapper { | ||||||
| 	return s.requestContextMapper | 	return s.requestContextMapper | ||||||
| } | } | ||||||
|  | func (s emptyDelegate) NextDelegate() DelegationTarget { | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| // RequestContextMapper is exposed so that third party resource storage can be build in a different location.
 | // RequestContextMapper is exposed so that third party resource storage can be build in a different location.
 | ||||||
| // TODO refactor third party resource storage
 | // TODO refactor third party resource storage
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue