Notify startup to grab a hold of handler and authenticator

This commit is contained in:
Darren Shepherd 2019-09-18 20:43:19 -07:00 committed by rafaelbreno[commit]
parent 65a3ccec71
commit c7b20dbaeb

View File

@ -35,6 +35,7 @@ import (
utilnet "k8s.io/apimachinery/pkg/util/net"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/authentication/authenticator"
genericapifilters "k8s.io/apiserver/pkg/endpoints/filters"
genericapiserver "k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/server/egressselector"
@ -142,6 +143,13 @@ cluster's shared state through which all other components interact.`,
return cmd
}
type startupConfig struct {
Handler http.Handler
Authenticator authenticator.Request
}
var StartupConfig = make(chan startupConfig, 1)
// Run runs the specified APIServer. This should never exit.
func Run(opts options.CompletedOptions, stopCh <-chan struct{}) error {
// To help debugging, immediately log version
@ -191,6 +199,12 @@ func CreateServerChain(config CompletedConfig) (*aggregatorapiserver.APIAggregat
return nil, err
}
StartupConfig <- startupConfig{
Handler: aggregatorServer.GenericAPIServer.Handler,
Authenticator: config.ControlPlane.GenericConfig.Authentication.Authenticator,
}
close(StartupConfig)
return aggregatorServer, nil
}