mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
apiserver: chain delegated PrepareRun
This commit is contained in:
parent
915be28b61
commit
7c4329ed45
@ -184,13 +184,6 @@ func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// otherwise go down the normal path of standing the aggregator up in front of the API server
|
||||
// this wires up openapi
|
||||
kubeAPIServer.GenericAPIServer.PrepareRun()
|
||||
|
||||
// This will wire up openapi for extension api server
|
||||
apiExtensionsServer.GenericAPIServer.PrepareRun()
|
||||
|
||||
// aggregator comes last in the chain
|
||||
aggregatorConfig, err := createAggregatorConfig(*kubeAPIServerConfig.GenericConfig, completedOptions.ServerRunOptions, kubeAPIServerConfig.ExtraConfig.VersionedInformers, serviceResolver, proxyTransport, pluginInitializer)
|
||||
if err != nil {
|
||||
|
@ -205,6 +205,9 @@ type DelegationTarget interface {
|
||||
|
||||
// NextDelegate returns the next delegationTarget in the chain of delegations
|
||||
NextDelegate() DelegationTarget
|
||||
|
||||
// PrepareRun does post API installation setup steps. It calls recursively the same function of the delegates.
|
||||
PrepareRun() preparedGenericAPIServer
|
||||
}
|
||||
|
||||
func (s *GenericAPIServer) UnprotectedHandler() http.Handler {
|
||||
@ -253,14 +256,19 @@ func (s emptyDelegate) ListedPaths() []string {
|
||||
func (s emptyDelegate) NextDelegate() DelegationTarget {
|
||||
return nil
|
||||
}
|
||||
func (s emptyDelegate) PrepareRun() preparedGenericAPIServer {
|
||||
return preparedGenericAPIServer{nil}
|
||||
}
|
||||
|
||||
// preparedGenericAPIServer is a private wrapper that enforces a call of PrepareRun() before Run can be invoked.
|
||||
type preparedGenericAPIServer struct {
|
||||
*GenericAPIServer
|
||||
}
|
||||
|
||||
// PrepareRun does post API installation setup steps.
|
||||
// PrepareRun does post API installation setup steps. It calls recursively the same function of the delegates.
|
||||
func (s *GenericAPIServer) PrepareRun() preparedGenericAPIServer {
|
||||
s.delegationTarget.PrepareRun()
|
||||
|
||||
if s.openAPIConfig != nil {
|
||||
s.OpenAPIVersionedService, s.StaticOpenAPISpec = routes.OpenAPI{
|
||||
Config: s.openAPIConfig,
|
||||
|
Loading…
Reference in New Issue
Block a user