Merge pull request #102687 from mengjiao-liu/rename-master-to-controlplane

test/integration: Rename master to controlplane
This commit is contained in:
Kubernetes Prow Robot 2021-06-14 09:49:16 -07:00 committed by GitHub
commit 51cbebab1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 33 deletions

View File

@ -75,15 +75,15 @@ func setup(t *testing.T, groupVersions ...schema.GroupVersion) (*httptest.Server
return setupWithResources(t, groupVersions, nil)
}
func setupWithOptions(t *testing.T, opts *framework.MasterConfigOptions, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
func setupWithOptions(t *testing.T, opts *framework.ControlPlaneConfigOptions, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
return setupWithResourcesWithOptions(t, opts, groupVersions, nil)
}
func setupWithResources(t *testing.T, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
return setupWithResourcesWithOptions(t, &framework.MasterConfigOptions{}, groupVersions, resources)
return setupWithResourcesWithOptions(t, &framework.ControlPlaneConfigOptions{}, groupVersions, resources)
}
func setupWithResourcesWithOptions(t *testing.T, opts *framework.MasterConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
func setupWithResourcesWithOptions(t *testing.T, opts *framework.ControlPlaneConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts)
if len(groupVersions) > 0 || len(resources) > 0 {
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
@ -224,12 +224,12 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) {
}
func TestCacheControl(t *testing.T) {
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{})
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{})
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
defer closeFn()
rt, err := restclient.TransportFor(master.GenericAPIServer.LoopbackClientConfig)
rt, err := restclient.TransportFor(instanceConfig.GenericAPIServer.LoopbackClientConfig)
if err != nil {
t.Fatal(err)
}
@ -253,7 +253,7 @@ func TestCacheControl(t *testing.T) {
}
for _, path := range paths {
t.Run(path, func(t *testing.T) {
req, err := http.NewRequest("GET", master.GenericAPIServer.LoopbackClientConfig.Host+path, nil)
req, err := http.NewRequest("GET", instanceConfig.GenericAPIServer.LoopbackClientConfig.Host+path, nil)
if err != nil {
t.Fatal(err)
}
@ -331,7 +331,7 @@ func TestListOptions(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)()
etcdOptions := framework.DefaultEtcdOptions()
etcdOptions.EnableWatchCache = watchCacheEnabled
s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions})
s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions})
defer closeFn()
ns := framework.CreateTestingNamespace("list-options", s, t)
@ -563,7 +563,7 @@ func TestListResourceVersion0(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.APIListChunking, true)()
etcdOptions := framework.DefaultEtcdOptions()
etcdOptions.EnableWatchCache = tc.watchCacheEnabled
s, clientSet, closeFn := setupWithOptions(t, &framework.MasterConfigOptions{EtcdOptions: etcdOptions})
s, clientSet, closeFn := setupWithOptions(t, &framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions})
defer closeFn()
ns := framework.CreateTestingNamespace("list-paging", s, t)

View File

@ -50,7 +50,7 @@ import (
)
func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts := framework.ControlPlaneConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
if len(groupVersions) > 0 {
@ -2819,14 +2819,14 @@ spec:
func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) {
sharedEtcd := framework.DefaultEtcdOptions()
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.ControlPlaneConfigOptions{
EtcdOptions: sharedEtcd,
})
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
_, master, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
client, err := clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
_, instanceConfig, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
client, err := clientset.NewForConfig(&restclient.Config{Host: instanceConfig.URL, QPS: -1})
if err != nil {
t.Fatalf("Error in create clientset: %v", err)
}
@ -2878,8 +2878,8 @@ spec:
// Restart server with server-side apply disabled
closeFn()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, false)()
_, master, closeFn = framework.RunAnAPIServer(controlPlaneConfig)
client, err = clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
_, instanceConfig, closeFn = framework.RunAnAPIServer(controlPlaneConfig)
client, err = clientset.NewForConfig(&restclient.Config{Host: instanceConfig.URL, QPS: -1})
if err != nil {
t.Fatalf("Error in create clientset: %v", err)
}

View File

@ -50,7 +50,7 @@ const (
)
func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) {
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts := framework.ControlPlaneConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
resourceConfig := controlplane.DefaultAPIResourceConfigSource()

View File

@ -54,7 +54,7 @@ func multiEtcdSetup(t testing.TB) (clientset.Interface, framework.CloseFunc) {
etcdOptions.EtcdServersOverrides = []string{fmt.Sprintf("/events#%s", etcd1URL)}
etcdOptions.EnableWatchCache = true
opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions}
opts := framework.ControlPlaneConfigOptions{EtcdOptions: etcdOptions}
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
// Switch off endpoints reconciler to avoid unnecessary operations.
controlPlaneConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType

View File

@ -119,16 +119,16 @@ func TestServiceAccountTokenCreate(t *testing.T) {
controlPlaneConfig.ExtraConfig.ServiceAccountJWKSURI = ""
controlPlaneConfig.ExtraConfig.ServiceAccountPublicKeys = []interface{}{&pk}
master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
instanceConfig, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
defer closeFn()
cs, err := clientset.NewForConfig(master.GenericAPIServer.LoopbackClientConfig)
cs, err := clientset.NewForConfig(instanceConfig.GenericAPIServer.LoopbackClientConfig)
if err != nil {
t.Fatalf("err: %v", err)
}
*gcs = *cs
rc, err := rest.UnversionedRESTClientFor(master.GenericAPIServer.LoopbackClientConfig)
rc, err := rest.UnversionedRESTClientFor(instanceConfig.GenericAPIServer.LoopbackClientConfig)
if err != nil {
t.Fatal(err)
}

View File

@ -59,10 +59,10 @@ import (
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
)
// Config is a struct of configuration directives for NewMasterComponents.
// Config is a struct of configuration directives for NewControlPlaneComponents.
type Config struct {
// If nil, a default is used, partially filled configs will not get populated.
MasterConfig *controlplane.Config
InstanceConfig *controlplane.Config
StartReplicationManager bool
// Client throttling qps
QPS float32
@ -123,7 +123,7 @@ func DefaultOpenAPIConfig() *openapicommon.Config {
return openAPIConfig
}
// startAPIServerOrDie starts a kubernetes master and an httpserver to handle api requests
// startAPIServerOrDie starts a kubernetes API server and an httpserver to handle api requests
func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
var m *controlplane.Instance
var s *httptest.Server
@ -210,9 +210,9 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
m, err = controlPlaneConfig.Complete().New(genericapiserver.NewEmptyDelegate())
if err != nil {
// We log the error first so that even if closeFn crashes, the error is shown
klog.Errorf("error in bringing up the master: %v", err)
klog.Errorf("error in bringing up the apiserver: %v", err)
closeFn()
klog.Fatalf("error in bringing up the master: %v", err)
klog.Fatalf("error in bringing up the apiserver: %v", err)
}
if apiServerReceiver != nil {
apiServerReceiver.SetAPIServer(m)
@ -251,14 +251,14 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
return m, s, closeFn
}
// NewIntegrationTestControlPlaneConfig returns the master config appropriate for most integration tests.
// NewIntegrationTestControlPlaneConfig returns the control plane config appropriate for most integration tests.
func NewIntegrationTestControlPlaneConfig() *controlplane.Config {
return NewIntegrationTestControlPlaneConfigWithOptions(&MasterConfigOptions{})
return NewIntegrationTestControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{})
}
// NewIntegrationTestControlPlaneConfigWithOptions returns the control plane config appropriate for most integration tests
// configured with the provided options.
func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
func NewIntegrationTestControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config {
controlPlaneConfig := NewControlPlaneConfigWithOptions(opts)
controlPlaneConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
@ -269,8 +269,8 @@ func NewIntegrationTestControlPlaneConfigWithOptions(opts *MasterConfigOptions)
return controlPlaneConfig
}
// MasterConfigOptions are the configurable options for a new integration test master config.
type MasterConfigOptions struct {
// ControlPlaneConfigOptions are the configurable options for a new integration test control plane config.
type ControlPlaneConfigOptions struct {
EtcdOptions *options.EtcdOptions
}
@ -286,11 +286,11 @@ func DefaultEtcdOptions() *options.EtcdOptions {
// NewControlPlaneConfig returns a basic control plane config.
func NewControlPlaneConfig() *controlplane.Config {
return NewControlPlaneConfigWithOptions(&MasterConfigOptions{})
return NewControlPlaneConfigWithOptions(&ControlPlaneConfigOptions{})
}
// NewControlPlaneConfigWithOptions returns a basic control plane config configured with the provided options.
func NewControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
func NewControlPlaneConfigWithOptions(opts *ControlPlaneConfigOptions) *controlplane.Config {
etcdOptions := DefaultEtcdOptions()
if opts.EtcdOptions != nil {
etcdOptions = opts.EtcdOptions
@ -338,7 +338,7 @@ func NewControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.C
}
}
// CloseFunc can be called to cleanup the master
// CloseFunc can be called to cleanup the API server
type CloseFunc func()
// RunAnAPIServer starts a API server with the provided config.