Part of master to controlplane in test/integration

NewMasterConfig -> NewControlPlaneConfig
This commit is contained in:
Mengjiao Liu 2021-05-25 17:58:31 +08:00
parent ae1f28d7b0
commit d3f92af74f
6 changed files with 15 additions and 15 deletions

View File

@ -31,7 +31,7 @@ import (
) )
func TestAdmission(t *testing.T) { func TestAdmission(t *testing.T) {
masterConfig := framework.NewMasterConfig() masterConfig := framework.NewControlPlaneConfig()
masterConfig.GenericConfig.EnableProfiling = true masterConfig.GenericConfig.EnableProfiling = true
masterConfig.GenericConfig.AdmissionControl = defaulttolerationseconds.NewDefaultTolerationSeconds() masterConfig.GenericConfig.AdmissionControl = defaulttolerationseconds.NewDefaultTolerationSeconds()
_, s, closeFn := framework.RunAMaster(masterConfig) _, s, closeFn := framework.RunAMaster(masterConfig)

View File

@ -153,7 +153,7 @@ func startApiserverOrDie(controlPlaneConfig *controlplane.Config, incomingServer
} }
if controlPlaneConfig == nil { if controlPlaneConfig == nil {
controlPlaneConfig = NewMasterConfig() controlPlaneConfig = NewControlPlaneConfig()
controlPlaneConfig.GenericConfig.OpenAPIConfig = DefaultOpenAPIConfig() controlPlaneConfig.GenericConfig.OpenAPIConfig = DefaultOpenAPIConfig()
} }
@ -256,10 +256,10 @@ func NewIntegrationTestControlPlaneConfig() *controlplane.Config {
return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{}) return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{})
} }
// NewIntegrationTestControlPlaneConfigWithOptions returns the master config appropriate for most integration tests // NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests
// configured with the provided options. // configured with the provided options.
func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config { func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
masterConfig := NewMasterConfigWithOptions(opts) masterConfig := NewControlPlaneConfigWithOptions(opts)
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4") masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
masterConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource() masterConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
@ -284,13 +284,13 @@ func DefaultEtcdOptions() *options.EtcdOptions {
return etcdOptions return etcdOptions
} }
// NewMasterConfig returns a basic master config. // NewControlPlaneConfig returns a basic control plane config.
func NewMasterConfig() *controlplane.Config { func NewControlPlaneConfig() *controlplane.Config {
return NewMasterConfigWithOptions(&MasterConfigOptions{}) return NewControlPlaneConfigWithOptions(&MasterConfigOptions{})
} }
// NewMasterConfigWithOptions returns a basic master config configured with the provided options. // NewControlPlaneConfigWithOptions returns a basic control plane config configured with the provided options.
func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config { func NewControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
etcdOptions := DefaultEtcdOptions() etcdOptions := DefaultEtcdOptions()
if opts.EtcdOptions != nil { if opts.EtcdOptions != nil {
etcdOptions = opts.EtcdOptions etcdOptions = opts.EtcdOptions
@ -344,7 +344,7 @@ type CloseFunc func()
// RunAMaster starts a master with the provided config. // RunAMaster starts a master with the provided config.
func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc) { func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc) {
if masterConfig == nil { if masterConfig == nil {
masterConfig = NewMasterConfig() masterConfig = NewControlPlaneConfig()
masterConfig.GenericConfig.EnableProfiling = true masterConfig.GenericConfig.EnableProfiling = true
} }
return startApiserverOrDie(masterConfig, nil, nil) return startApiserverOrDie(masterConfig, nil, nil)

View File

@ -94,7 +94,7 @@ func TestAppsPrefix(t *testing.T) {
} }
func TestKubernetesService(t *testing.T) { func TestKubernetesService(t *testing.T) {
config := framework.NewMasterConfig() config := framework.NewControlPlaneConfig()
_, _, closeFn := framework.RunAMaster(config) _, _, closeFn := framework.RunAMaster(config)
defer closeFn() defer closeFn()
coreClient := clientset.NewForConfigOrDie(config.GenericConfig.LoopbackClientConfig) coreClient := clientset.NewForConfigOrDie(config.GenericConfig.LoopbackClientConfig)

View File

@ -266,7 +266,7 @@ func TestApiserverMetricsPods(t *testing.T) {
} }
} }
_, server, closeFn := framework.RunAMaster(framework.NewMasterConfig()) _, server, closeFn := framework.RunAMaster(framework.NewControlPlaneConfig())
defer closeFn() defer closeFn()
client, err := clientset.NewForConfig(&restclient.Config{Host: server.URL, QPS: -1}) client, err := clientset.NewForConfig(&restclient.Config{Host: server.URL, QPS: -1})
@ -372,7 +372,7 @@ func TestApiserverMetricsNamespaces(t *testing.T) {
} }
} }
_, server, closeFn := framework.RunAMaster(framework.NewMasterConfig()) _, server, closeFn := framework.RunAMaster(framework.NewControlPlaneConfig())
defer closeFn() defer closeFn()
client, err := clientset.NewForConfig(&restclient.Config{Host: server.URL, QPS: -1}) client, err := clientset.NewForConfig(&restclient.Config{Host: server.URL, QPS: -1})

View File

@ -31,7 +31,7 @@ import (
) )
func TestIgnoreClusterName(t *testing.T) { func TestIgnoreClusterName(t *testing.T) {
config := framework.NewMasterConfig() config := framework.NewControlPlaneConfig()
_, s, closeFn := framework.RunAMaster(config) _, s, closeFn := framework.RunAMaster(config)
defer closeFn() defer closeFn()

View File

@ -400,7 +400,7 @@ func startServiceAccountTestServer(t *testing.T) (*clientset.Clientset, restclie
serviceAccountAdmission.SetExternalKubeClientSet(externalRootClientset) serviceAccountAdmission.SetExternalKubeClientSet(externalRootClientset)
serviceAccountAdmission.SetExternalKubeInformerFactory(externalInformers) serviceAccountAdmission.SetExternalKubeInformerFactory(externalInformers)
masterConfig := framework.NewMasterConfig() masterConfig := framework.NewControlPlaneConfig()
masterConfig.GenericConfig.EnableIndex = true masterConfig.GenericConfig.EnableIndex = true
masterConfig.GenericConfig.Authentication.Authenticator = authenticator masterConfig.GenericConfig.Authentication.Authenticator = authenticator
masterConfig.GenericConfig.Authorization.Authorizer = authorizer masterConfig.GenericConfig.Authorization.Authorizer = authorizer