kube-apiserver: fix tests which don't use tls yet

This commit is contained in:
Dr. Stefan Schimanski
2018-07-06 19:20:45 +02:00
parent e15ac9eb72
commit 6bb3aba23d
4 changed files with 47 additions and 0 deletions

View File

@@ -225,6 +225,10 @@ func NewIntegrationTestMasterConfig() *master.Config {
masterConfig := NewMasterConfig()
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
masterConfig.ExtraConfig.APIResourceConfigSource = master.DefaultAPIResourceConfigSource()
// TODO: get rid of these tests or port them to secure serving
masterConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
return masterConfig
}
@@ -291,6 +295,9 @@ func NewMasterConfig() *master.Config {
genericConfig.Version = &kubeVersion
genericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer()
// TODO: get rid of these tests or port them to secure serving
genericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
err := etcdOptions.ApplyWithStorageFactoryTo(storageFactory, genericConfig)
if err != nil {
panic(err)
@@ -329,3 +336,20 @@ func SharedEtcd() *storagebackend.Config {
cfg.ServerList = []string{GetEtcdURL()}
return cfg
}
type fakeLocalhost443Listener struct{}
func (fakeLocalhost443Listener) Accept() (net.Conn, error) {
return nil, nil
}
func (fakeLocalhost443Listener) Close() error {
return nil
}
func (fakeLocalhost443Listener) Addr() net.Addr {
return &net.TCPAddr{
IP: net.IPv4(127, 0, 0, 1),
Port: 443,
}
}