mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Rename masterConfig to controlPlaneConfig
This commit is contained in:
parent
a4e5239bdc
commit
6871b2b3c7
@ -66,11 +66,11 @@ func TestWatchRestartsIfTimeoutNotReached(t *testing.T) {
|
|||||||
// Has to be longer than 5 seconds
|
// Has to be longer than 5 seconds
|
||||||
timeout := 30 * time.Second
|
timeout := 30 * time.Second
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
// Timeout is set random between MinRequestTimeout and 2x
|
// Timeout is set random between MinRequestTimeout and 2x
|
||||||
masterConfig.GenericConfig.MinRequestTimeout = int(timeout.Seconds()) / 4
|
controlPlaneConfig.GenericConfig.MinRequestTimeout = int(timeout.Seconds()) / 4
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := &restclient.Config{
|
config := &restclient.Config{
|
||||||
|
@ -43,8 +43,8 @@ import (
|
|||||||
|
|
||||||
func TestWebsocketWatchClientTimeout(t *testing.T) {
|
func TestWebsocketWatchClientTimeout(t *testing.T) {
|
||||||
// server setup
|
// server setup
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
instance, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
instance, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
// object setup
|
// object setup
|
||||||
@ -143,8 +143,8 @@ func TestWebsocketWatchClientTimeout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestWatchClientTimeout(t *testing.T) {
|
func TestWatchClientTimeout(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
t.Run("direct", func(t *testing.T) {
|
t.Run("direct", func(t *testing.T) {
|
||||||
|
@ -84,15 +84,15 @@ func setupWithResources(t *testing.T, groupVersions []schema.GroupVersion, resou
|
|||||||
}
|
}
|
||||||
|
|
||||||
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.MasterConfigOptions, groupVersions []schema.GroupVersion, resources []schema.GroupVersionResource) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts)
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(opts)
|
||||||
if len(groupVersions) > 0 || len(resources) > 0 {
|
if len(groupVersions) > 0 || len(resources) > 0 {
|
||||||
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
||||||
resourceConfig.EnableVersions(groupVersions...)
|
resourceConfig.EnableVersions(groupVersions...)
|
||||||
resourceConfig.EnableResources(resources...)
|
resourceConfig.EnableResources(resources...)
|
||||||
masterConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
}
|
}
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -224,9 +224,9 @@ func Test4xxStatusCodeInvalidPatch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCacheControl(t *testing.T) {
|
func TestCacheControl(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{})
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{})
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
master, _, closeFn := framework.RunAnAPIServer(masterConfig)
|
master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
rt, err := restclient.TransportFor(master.GenericAPIServer.LoopbackClientConfig)
|
rt, err := restclient.TransportFor(master.GenericAPIServer.LoopbackClientConfig)
|
||||||
|
@ -52,14 +52,14 @@ import (
|
|||||||
func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
|
func setup(t testing.TB, groupVersions ...schema.GroupVersion) (*httptest.Server, clientset.Interface, framework.CloseFunc) {
|
||||||
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
|
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
|
||||||
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
||||||
if len(groupVersions) > 0 {
|
if len(groupVersions) > 0 {
|
||||||
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
||||||
resourceConfig.EnableVersions(groupVersions...)
|
resourceConfig.EnableVersions(groupVersions...)
|
||||||
masterConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
}
|
}
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
clientSet, err := clientset.NewForConfig(&restclient.Config{Host: s.URL, QPS: -1})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2819,13 +2819,13 @@ spec:
|
|||||||
|
|
||||||
func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) {
|
func TestStopTrackingManagedFieldsOnFeatureDisabled(t *testing.T) {
|
||||||
sharedEtcd := framework.DefaultEtcdOptions()
|
sharedEtcd := framework.DefaultEtcdOptions()
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&framework.MasterConfigOptions{
|
||||||
EtcdOptions: sharedEtcd,
|
EtcdOptions: sharedEtcd,
|
||||||
})
|
})
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, true)()
|
||||||
_, master, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, master, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
client, err := clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
|
client, err := clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error in create clientset: %v", err)
|
t.Fatalf("Error in create clientset: %v", err)
|
||||||
@ -2878,7 +2878,7 @@ spec:
|
|||||||
// Restart server with server-side apply disabled
|
// Restart server with server-side apply disabled
|
||||||
closeFn()
|
closeFn()
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, false)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.ServerSideApply, false)()
|
||||||
_, master, closeFn = framework.RunAnAPIServer(masterConfig)
|
_, master, closeFn = framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
client, err = clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
|
client, err = clientset.NewForConfig(&restclient.Config{Host: master.URL, QPS: -1})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error in create clientset: %v", err)
|
t.Fatalf("Error in create clientset: %v", err)
|
||||||
|
@ -52,19 +52,19 @@ const (
|
|||||||
func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) {
|
func setup(t testing.TB, maxReadonlyRequestsInFlight, MaxMutatingRequestsInFlight int) (*httptest.Server, *rest.Config, framework.CloseFunc) {
|
||||||
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
|
opts := framework.MasterConfigOptions{EtcdOptions: framework.DefaultEtcdOptions()}
|
||||||
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
opts.EtcdOptions.DefaultStorageMediaType = "application/vnd.kubernetes.protobuf"
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
||||||
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
||||||
resourceConfig.EnableVersions(schema.GroupVersion{
|
resourceConfig.EnableVersions(schema.GroupVersion{
|
||||||
Group: "flowcontrol.apiserver.k8s.io",
|
Group: "flowcontrol.apiserver.k8s.io",
|
||||||
Version: "v1alpha1",
|
Version: "v1alpha1",
|
||||||
})
|
})
|
||||||
masterConfig.GenericConfig.MaxRequestsInFlight = maxReadonlyRequestsInFlight
|
controlPlaneConfig.GenericConfig.MaxRequestsInFlight = maxReadonlyRequestsInFlight
|
||||||
masterConfig.GenericConfig.MaxMutatingRequestsInFlight = MaxMutatingRequestsInFlight
|
controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight = MaxMutatingRequestsInFlight
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
masterConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
return s, masterConfig.GenericConfig.LoopbackClientConfig, closeFn
|
return s, controlPlaneConfig.GenericConfig.LoopbackClientConfig, closeFn
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPriorityLevelIsolation(t *testing.T) {
|
func TestPriorityLevelIsolation(t *testing.T) {
|
||||||
|
@ -55,10 +55,10 @@ func multiEtcdSetup(t testing.TB) (clientset.Interface, framework.CloseFunc) {
|
|||||||
etcdOptions.EnableWatchCache = true
|
etcdOptions.EnableWatchCache = true
|
||||||
|
|
||||||
opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions}
|
opts := framework.MasterConfigOptions{EtcdOptions: etcdOptions}
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfigWithOptions(&opts)
|
||||||
// Switch off endpoints reconciler to avoid unnecessary operations.
|
// Switch off endpoints reconciler to avoid unnecessary operations.
|
||||||
masterConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType
|
controlPlaneConfig.ExtraConfig.EndpointReconcilerType = reconcilers.NoneEndpointReconcilerType
|
||||||
_, s, stopMaster := framework.RunAnAPIServer(masterConfig)
|
_, s, stopMaster := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
closeFn := func() {
|
closeFn := func() {
|
||||||
stopMaster()
|
stopMaster()
|
||||||
|
@ -55,10 +55,10 @@ func alwaysAlice(req *http.Request) (*authenticator.Response, bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSubjectAccessReview(t *testing.T) {
|
func TestSubjectAccessReview(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
||||||
@ -146,14 +146,14 @@ func TestSubjectAccessReview(t *testing.T) {
|
|||||||
|
|
||||||
func TestSelfSubjectAccessReview(t *testing.T) {
|
func TestSelfSubjectAccessReview(t *testing.T) {
|
||||||
username := "alice"
|
username := "alice"
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(func(req *http.Request) (*authenticator.Response, bool, error) {
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(func(req *http.Request) (*authenticator.Response, bool, error) {
|
||||||
return &authenticator.Response{
|
return &authenticator.Response{
|
||||||
User: &user.DefaultInfo{Name: username},
|
User: &user.DefaultInfo{Name: username},
|
||||||
}, true, nil
|
}, true, nil
|
||||||
})
|
})
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
||||||
@ -229,10 +229,10 @@ func TestSelfSubjectAccessReview(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLocalSubjectAccessReview(t *testing.T) {
|
func TestLocalSubjectAccessReview(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
clientset := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL})
|
||||||
|
@ -439,9 +439,9 @@ func getTestRequests(namespace string) []struct {
|
|||||||
//
|
//
|
||||||
// TODO(etune): write a fuzz test of the REST API.
|
// TODO(etune): write a fuzz test of the REST API.
|
||||||
func TestAuthModeAlwaysAllow(t *testing.T) {
|
func TestAuthModeAlwaysAllow(t *testing.T) {
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-always-allow", s, t)
|
ns := framework.CreateTestingNamespace("auth-always-allow", s, t)
|
||||||
@ -536,10 +536,10 @@ func getPreviousResourceVersionKey(url, id string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthModeAlwaysDeny(t *testing.T) {
|
func TestAuthModeAlwaysDeny(t *testing.T) {
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-always-deny", s, t)
|
ns := framework.CreateTestingNamespace("auth-always-deny", s, t)
|
||||||
@ -585,11 +585,11 @@ func (allowAliceAuthorizer) Authorize(ctx context.Context, a authorizer.Attribut
|
|||||||
func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
||||||
// This file has alice and bob in it.
|
// This file has alice and bob in it.
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-alice-not-forbidden", s, t)
|
ns := framework.CreateTestingNamespace("auth-alice-not-forbidden", s, t)
|
||||||
@ -655,10 +655,10 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
|||||||
// should receive "Forbidden".
|
// should receive "Forbidden".
|
||||||
func TestBobIsForbidden(t *testing.T) {
|
func TestBobIsForbidden(t *testing.T) {
|
||||||
// This file has alice and bob in it.
|
// This file has alice and bob in it.
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-bob-forbidden", s, t)
|
ns := framework.CreateTestingNamespace("auth-bob-forbidden", s, t)
|
||||||
@ -698,11 +698,11 @@ func TestBobIsForbidden(t *testing.T) {
|
|||||||
func TestUnknownUserIsUnauthorized(t *testing.T) {
|
func TestUnknownUserIsUnauthorized(t *testing.T) {
|
||||||
// This file has alice and bob in it.
|
// This file has alice and bob in it.
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-unknown-unauthorized", s, t)
|
ns := framework.CreateTestingNamespace("auth-unknown-unauthorized", s, t)
|
||||||
@ -760,11 +760,11 @@ func (impersonateAuthorizer) Authorize(ctx context.Context, a authorizer.Attribu
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestImpersonateIsForbidden(t *testing.T) {
|
func TestImpersonateIsForbidden(t *testing.T) {
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = impersonateAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = impersonateAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-impersonate-forbidden", s, t)
|
ns := framework.CreateTestingNamespace("auth-impersonate-forbidden", s, t)
|
||||||
@ -907,11 +907,11 @@ func (a *trackingAuthorizer) Authorize(ctx context.Context, attributes authorize
|
|||||||
func TestAuthorizationAttributeDetermination(t *testing.T) {
|
func TestAuthorizationAttributeDetermination(t *testing.T) {
|
||||||
trackingAuthorizer := &trackingAuthorizer{}
|
trackingAuthorizer := &trackingAuthorizer{}
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = trackingAuthorizer
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = trackingAuthorizer
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-attribute-determination", s, t)
|
ns := framework.CreateTestingNamespace("auth-attribute-determination", s, t)
|
||||||
@ -973,11 +973,11 @@ func TestNamespaceAuthorization(t *testing.T) {
|
|||||||
a := newAuthorizerWithContents(t, `{"namespace": "auth-namespace"}
|
a := newAuthorizerWithContents(t, `{"namespace": "auth-namespace"}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = a
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-namespace", s, t)
|
ns := framework.CreateTestingNamespace("auth-namespace", s, t)
|
||||||
@ -1071,11 +1071,11 @@ func TestKindAuthorization(t *testing.T) {
|
|||||||
a := newAuthorizerWithContents(t, `{"resource": "services"}
|
a := newAuthorizerWithContents(t, `{"resource": "services"}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = a
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-kind", s, t)
|
ns := framework.CreateTestingNamespace("auth-kind", s, t)
|
||||||
@ -1155,11 +1155,11 @@ func TestReadOnlyAuthorization(t *testing.T) {
|
|||||||
// This file has alice and bob in it.
|
// This file has alice and bob in it.
|
||||||
a := newAuthorizerWithContents(t, `{"readonly": true}`)
|
a := newAuthorizerWithContents(t, `{"readonly": true}`)
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = a
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-read-only", s, t)
|
ns := framework.CreateTestingNamespace("auth-read-only", s, t)
|
||||||
@ -1232,11 +1232,11 @@ func testWebhookTokenAuthenticator(customDialer bool, t *testing.T) {
|
|||||||
t.Fatalf("error starting webhook token authenticator server: %v", err)
|
t.Fatalf("error starting webhook token authenticator server: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-webhook-token", s, t)
|
ns := framework.CreateTestingNamespace("auth-webhook-token", s, t)
|
||||||
|
@ -116,10 +116,10 @@ func TestBootstrapTokenAuth(t *testing.T) {
|
|||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
||||||
authenticator := bearertoken.New(bootstrap.NewTokenAuthenticator(bootstrapSecrets{test.secret}))
|
authenticator := bearertoken.New(bootstrap.NewTokenAuthenticator(bootstrapSecrets{test.secret}))
|
||||||
// Set up a master
|
// Set up an API server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("auth-bootstrap-token", s, t)
|
ns := framework.CreateTestingNamespace("auth-bootstrap-token", s, t)
|
||||||
|
@ -519,9 +519,9 @@ func TestRBAC(t *testing.T) {
|
|||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
// Create an API Server.
|
// Create an API Server.
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, controlPlaneConfig)
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||||
"any-rolebinding-writer": {Name: "any-rolebinding-writer"},
|
"any-rolebinding-writer": {Name: "any-rolebinding-writer"},
|
||||||
"any-rolebinding-writer-namespace": {Name: "any-rolebinding-writer-namespace"},
|
"any-rolebinding-writer-namespace": {Name: "any-rolebinding-writer-namespace"},
|
||||||
@ -534,8 +534,8 @@ func TestRBAC(t *testing.T) {
|
|||||||
"limitrange-patcher": {Name: "limitrange-patcher"},
|
"limitrange-patcher": {Name: "limitrange-patcher"},
|
||||||
"user-with-no-permissions": {Name: "user-with-no-permissions"},
|
"user-with-no-permissions": {Name: "user-with-no-permissions"},
|
||||||
}))
|
}))
|
||||||
masterConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
controlPlaneConfig.GenericConfig.OpenAPIConfig = framework.DefaultOpenAPIConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
clientConfig := &restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{NegotiatedSerializer: legacyscheme.Codecs}}
|
clientConfig := &restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{NegotiatedSerializer: legacyscheme.Codecs}}
|
||||||
@ -642,12 +642,12 @@ func TestRBAC(t *testing.T) {
|
|||||||
func TestBootstrapping(t *testing.T) {
|
func TestBootstrapping(t *testing.T) {
|
||||||
superUser := "admin/system:masters"
|
superUser := "admin/system:masters"
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, controlPlaneConfig)
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||||
}))
|
}))
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
clientset := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
clientset := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
||||||
@ -703,12 +703,12 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
|
|||||||
|
|
||||||
superUser := "admin/system:masters"
|
superUser := "admin/system:masters"
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, controlPlaneConfig)
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||||
}))
|
}))
|
||||||
_, s, tearDownFn := framework.RunAnAPIServer(masterConfig)
|
_, s, tearDownFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
client := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
client := clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
|
|||||||
|
|
||||||
// Check that upgraded API servers inherit `system:public-info-viewer` settings from
|
// Check that upgraded API servers inherit `system:public-info-viewer` settings from
|
||||||
// `system:discovery`, and respect auto-reconciliation annotations.
|
// `system:discovery`, and respect auto-reconciliation annotations.
|
||||||
_, s, tearDownFn = framework.RunAnAPIServer(masterConfig)
|
_, s, tearDownFn = framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
client = clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
client = clientset.NewForConfigOrDie(&restclient.Config{BearerToken: superUser, Host: s.URL})
|
||||||
|
|
||||||
|
@ -83,10 +83,10 @@ func TestServiceAccountTokenCreate(t *testing.T) {
|
|||||||
gcs := &clientset.Clientset{}
|
gcs := &clientset.Clientset{}
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer()
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer()
|
||||||
masterConfig.GenericConfig.Authentication.APIAudiences = aud
|
controlPlaneConfig.GenericConfig.Authentication.APIAudiences = aud
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(
|
||||||
serviceaccount.JWTTokenAuthenticator(
|
serviceaccount.JWTTokenAuthenticator(
|
||||||
[]string{iss},
|
[]string{iss},
|
||||||
[]interface{}{&pk},
|
[]interface{}{&pk},
|
||||||
@ -110,16 +110,16 @@ func TestServiceAccountTokenCreate(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err: %v", err)
|
t.Fatalf("err: %v", err)
|
||||||
}
|
}
|
||||||
masterConfig.ExtraConfig.ServiceAccountIssuer = tokenGenerator
|
controlPlaneConfig.ExtraConfig.ServiceAccountIssuer = tokenGenerator
|
||||||
masterConfig.ExtraConfig.ServiceAccountMaxExpiration = maxExpirationDuration
|
controlPlaneConfig.ExtraConfig.ServiceAccountMaxExpiration = maxExpirationDuration
|
||||||
masterConfig.GenericConfig.Authentication.APIAudiences = aud
|
controlPlaneConfig.GenericConfig.Authentication.APIAudiences = aud
|
||||||
masterConfig.ExtraConfig.ExtendExpiration = true
|
controlPlaneConfig.ExtraConfig.ExtendExpiration = true
|
||||||
|
|
||||||
masterConfig.ExtraConfig.ServiceAccountIssuerURL = iss
|
controlPlaneConfig.ExtraConfig.ServiceAccountIssuerURL = iss
|
||||||
masterConfig.ExtraConfig.ServiceAccountJWKSURI = ""
|
controlPlaneConfig.ExtraConfig.ServiceAccountJWKSURI = ""
|
||||||
masterConfig.ExtraConfig.ServiceAccountPublicKeys = []interface{}{&pk}
|
controlPlaneConfig.ExtraConfig.ServiceAccountPublicKeys = []interface{}{&pk}
|
||||||
|
|
||||||
master, _, closeFn := framework.RunAnAPIServer(masterConfig)
|
master, _, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
cs, err := clientset.NewForConfig(master.GenericAPIServer.LoopbackClientConfig)
|
cs, err := clientset.NewForConfig(master.GenericAPIServer.LoopbackClientConfig)
|
||||||
@ -372,7 +372,7 @@ func TestServiceAccountTokenCreate(t *testing.T) {
|
|||||||
ObjectMeta: sa.ObjectMeta,
|
ObjectMeta: sa.ObjectMeta,
|
||||||
}
|
}
|
||||||
_, pc := serviceaccount.Claims(coresa, nil, nil, 0, 0, nil)
|
_, pc := serviceaccount.Claims(coresa, nil, nil, 0, 0, nil)
|
||||||
tok, err := masterConfig.ExtraConfig.ServiceAccountIssuer.GenerateToken(sc, pc)
|
tok, err := controlPlaneConfig.ExtraConfig.ServiceAccountIssuer.GenerateToken(sc, pc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("err signing expired token: %v", err)
|
t.Fatalf("err signing expired token: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *cronjob.Controller, *job.Controller, informers.SharedInformerFactory, clientset.Interface, restclient.Config) {
|
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *cronjob.Controller, *job.Controller, informers.SharedInformerFactory, clientset.Interface, restclient.Config) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -52,8 +52,8 @@ import (
|
|||||||
var zero = int64(0)
|
var zero = int64(0)
|
||||||
|
|
||||||
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *daemon.DaemonSetsController, informers.SharedInformerFactory, clientset.Interface) {
|
func setup(t *testing.T) (*httptest.Server, framework.CloseFunc, *daemon.DaemonSetsController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -31,10 +31,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAdmission(t *testing.T) {
|
func TestAdmission(t *testing.T) {
|
||||||
masterConfig := framework.NewControlPlaneConfig()
|
controlPlaneConfig := framework.NewControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.EnableProfiling = true
|
controlPlaneConfig.GenericConfig.EnableProfiling = true
|
||||||
masterConfig.GenericConfig.AdmissionControl = defaulttolerationseconds.NewDefaultTolerationSeconds()
|
controlPlaneConfig.GenericConfig.AdmissionControl = defaulttolerationseconds.NewDefaultTolerationSeconds()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
client := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
client := clientset.NewForConfigOrDie(&restclient.Config{Host: s.URL, ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Group: "", Version: "v1"}}})
|
||||||
|
@ -103,8 +103,8 @@ func newDeployment(name, ns string, replicas int32) *apps.Deployment {
|
|||||||
|
|
||||||
// dcSetup sets up necessities for Deployment integration test, including master, apiserver, informers, and clientset
|
// dcSetup sets up necessities for Deployment integration test, including master, apiserver, informers, and clientset
|
||||||
func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, *deployment.DeploymentController, informers.SharedInformerFactory, clientset.Interface) {
|
func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, *deployment.DeploymentController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
@ -135,8 +135,8 @@ func dcSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.R
|
|||||||
// dcSimpleSetup sets up necessities for Deployment integration test, including master, apiserver,
|
// dcSimpleSetup sets up necessities for Deployment integration test, including master, apiserver,
|
||||||
// and clientset, but not controllers and informers
|
// and clientset, but not controllers and informers
|
||||||
func dcSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
|
func dcSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -33,8 +33,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEndpointUpdates(t *testing.T) {
|
func TestEndpointUpdates(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
|
@ -39,8 +39,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEndpointSliceMirroring(t *testing.T) {
|
func TestEndpointSliceMirroring(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
@ -233,8 +233,8 @@ func TestEndpointSliceMirroring(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEndpointSliceMirroringUpdates(t *testing.T) {
|
func TestEndpointSliceMirroringUpdates(t *testing.T) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
|
@ -421,8 +421,8 @@ func newV1Eviction(ns, evictionName string, deleteOption metav1.DeleteOptions) *
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *disruption.DisruptionController, informers.SharedInformerFactory, clientset.Interface) {
|
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *disruption.DisruptionController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -259,14 +259,14 @@ func NewIntegrationTestControlPlaneConfig() *controlplane.Config {
|
|||||||
// NewIntegrationTestControlPlaneConfigWithOptions returns the control plane 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 := NewControlPlaneConfigWithOptions(opts)
|
controlPlaneConfig := NewControlPlaneConfigWithOptions(opts)
|
||||||
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
|
controlPlaneConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
|
||||||
masterConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
|
||||||
|
|
||||||
// TODO: get rid of these tests or port them to secure serving
|
// TODO: get rid of these tests or port them to secure serving
|
||||||
masterConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
|
controlPlaneConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
|
||||||
|
|
||||||
return masterConfig
|
return controlPlaneConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// MasterConfigOptions are the configurable options for a new integration test master config.
|
// MasterConfigOptions are the configurable options for a new integration test master config.
|
||||||
@ -342,12 +342,12 @@ func NewControlPlaneConfigWithOptions(opts *MasterConfigOptions) *controlplane.C
|
|||||||
type CloseFunc func()
|
type CloseFunc func()
|
||||||
|
|
||||||
// RunAnAPIServer starts a API server with the provided config.
|
// RunAnAPIServer starts a API server with the provided config.
|
||||||
func RunAnAPIServer(masterConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc) {
|
func RunAnAPIServer(controlPlaneConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc) {
|
||||||
if masterConfig == nil {
|
if controlPlaneConfig == nil {
|
||||||
masterConfig = NewControlPlaneConfig()
|
controlPlaneConfig = NewControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.EnableProfiling = true
|
controlPlaneConfig.GenericConfig.EnableProfiling = true
|
||||||
}
|
}
|
||||||
return startAPIServerOrDie(masterConfig, nil, nil)
|
return startAPIServerOrDie(controlPlaneConfig, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunAnAPIServerUsingServer starts up an instance using the provided config on the specified server.
|
// RunAnAPIServerUsingServer starts up an instance using the provided config on the specified server.
|
||||||
|
@ -607,8 +607,8 @@ func createJobWithDefaults(ctx context.Context, clientSet clientset.Interface, n
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setup(t *testing.T, nsBaseName string) (framework.CloseFunc, *restclient.Config, clientset.Interface, *v1.Namespace) {
|
func setup(t *testing.T, nsBaseName string) (framework.CloseFunc, *restclient.Config, clientset.Interface, *v1.Namespace) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, apiServerCloseFn := framework.RunAnAPIServer(masterConfig)
|
_, server, apiServerCloseFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -140,25 +140,25 @@ func TestEmptyList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initStatusForbiddenControlPlaneConfig() *controlplane.Config {
|
func initStatusForbiddenControlPlaneConfig() *controlplane.Config {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
|
||||||
return masterConfig
|
return controlPlaneConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func initUnauthorizedControlPlaneConfig() *controlplane.Config {
|
func initUnauthorizedControlPlaneConfig() *controlplane.Config {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
tokenAuthenticator := tokentest.New()
|
tokenAuthenticator := tokentest.New()
|
||||||
tokenAuthenticator.Tokens[AliceToken] = &user.DefaultInfo{Name: "alice", UID: "1"}
|
tokenAuthenticator.Tokens[AliceToken] = &user.DefaultInfo{Name: "alice", UID: "1"}
|
||||||
tokenAuthenticator.Tokens[BobToken] = &user.DefaultInfo{Name: "bob", UID: "2"}
|
tokenAuthenticator.Tokens[BobToken] = &user.DefaultInfo{Name: "bob", UID: "2"}
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = group.NewGroupAdder(bearertoken.New(tokenAuthenticator), []string{user.AllAuthenticated})
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = group.NewGroupAdder(bearertoken.New(tokenAuthenticator), []string{user.AllAuthenticated})
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||||
return masterConfig
|
return controlPlaneConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStatus(t *testing.T) {
|
func TestStatus(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
masterConfig *controlplane.Config
|
controlPlaneConfig *controlplane.Config
|
||||||
statusCode int
|
statusCode int
|
||||||
reqPath string
|
reqPath string
|
||||||
reason string
|
reason string
|
||||||
@ -166,7 +166,7 @@ func TestStatus(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "404",
|
name: "404",
|
||||||
masterConfig: nil,
|
controlPlaneConfig: nil,
|
||||||
statusCode: http.StatusNotFound,
|
statusCode: http.StatusNotFound,
|
||||||
reqPath: "/apis/batch/v1/namespaces/default/jobs/foo",
|
reqPath: "/apis/batch/v1/namespaces/default/jobs/foo",
|
||||||
reason: "NotFound",
|
reason: "NotFound",
|
||||||
@ -174,7 +174,7 @@ func TestStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "403",
|
name: "403",
|
||||||
masterConfig: initStatusForbiddenControlPlaneConfig(),
|
controlPlaneConfig: initStatusForbiddenControlPlaneConfig(),
|
||||||
statusCode: http.StatusForbidden,
|
statusCode: http.StatusForbidden,
|
||||||
reqPath: "/apis",
|
reqPath: "/apis",
|
||||||
reason: "Forbidden",
|
reason: "Forbidden",
|
||||||
@ -182,7 +182,7 @@ func TestStatus(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "401",
|
name: "401",
|
||||||
masterConfig: initUnauthorizedControlPlaneConfig(),
|
controlPlaneConfig: initUnauthorizedControlPlaneConfig(),
|
||||||
statusCode: http.StatusUnauthorized,
|
statusCode: http.StatusUnauthorized,
|
||||||
reqPath: "/apis",
|
reqPath: "/apis",
|
||||||
reason: "Unauthorized",
|
reason: "Unauthorized",
|
||||||
@ -191,7 +191,7 @@ func TestStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
_, s, closeFn := framework.RunAnAPIServer(tc.masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(tc.controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
u := s.URL + tc.reqPath
|
u := s.URL + tc.reqPath
|
||||||
|
@ -165,8 +165,8 @@ func jsonToUnstructured(stub, version, kind string) (*unstructured.Unstructured,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func namespaceLifecycleSetup(t *testing.T) (framework.CloseFunc, *namespace.NamespaceController, informers.SharedInformerFactory, clientset.Interface, dynamic.Interface) {
|
func namespaceLifecycleSetup(t *testing.T) (framework.CloseFunc, *namespace.NamespaceController, informers.SharedInformerFactory, clientset.Interface, dynamic.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
config.QPS = 10000
|
config.QPS = 10000
|
||||||
|
@ -75,9 +75,9 @@ func TestQuota(t *testing.T) {
|
|||||||
admission.SetQuotaConfiguration(qca)
|
admission.SetQuotaConfiguration(qca)
|
||||||
defer close(admissionCh)
|
defer close(admissionCh)
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.AdmissionControl = admission
|
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||||
_, _, closeFn := framework.RunAnAPIServerUsingServer(masterConfig, s, h)
|
_, _, closeFn := framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("quotaed", s, t)
|
ns := framework.CreateTestingNamespace("quotaed", s, t)
|
||||||
@ -275,9 +275,9 @@ func TestQuotaLimitedResourceDenial(t *testing.T) {
|
|||||||
admission.SetQuotaConfiguration(qca)
|
admission.SetQuotaConfiguration(qca)
|
||||||
defer close(admissionCh)
|
defer close(admissionCh)
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.AdmissionControl = admission
|
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||||
_, _, closeFn := framework.RunAnAPIServerUsingServer(masterConfig, s, h)
|
_, _, closeFn := framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
ns := framework.CreateTestingNamespace("quota", s, t)
|
ns := framework.CreateTestingNamespace("quota", s, t)
|
||||||
|
@ -118,8 +118,8 @@ func newMatchingPod(podName, namespace string) *v1.Pod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, informers.SharedInformerFactory, clientset.Interface) {
|
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.ReplicaSetController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
@ -140,8 +140,8 @@ func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replicaset.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rmSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
|
func rmSimpleSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -111,8 +111,8 @@ func newMatchingPod(podName, namespace string) *v1.Pod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
|
func rmSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *replication.ReplicationManager, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -36,8 +36,8 @@ import (
|
|||||||
func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
|
func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
@ -80,8 +80,8 @@ func Test_ServiceLoadBalancerDisableAllocateNodePorts(t *testing.T) {
|
|||||||
func Test_ServiceLoadBalancerEnableThenDisableAllocatedNodePorts(t *testing.T) {
|
func Test_ServiceLoadBalancerEnableThenDisableAllocatedNodePorts(t *testing.T) {
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ServiceLBNodePortControl, true)()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, server, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, server, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
defer closeFn()
|
defer closeFn()
|
||||||
|
|
||||||
config := restclient.Config{Host: server.URL}
|
config := restclient.Config{Host: server.URL}
|
||||||
|
@ -400,12 +400,12 @@ func startServiceAccountTestServer(t *testing.T) (*clientset.Clientset, restclie
|
|||||||
serviceAccountAdmission.SetExternalKubeClientSet(externalRootClientset)
|
serviceAccountAdmission.SetExternalKubeClientSet(externalRootClientset)
|
||||||
serviceAccountAdmission.SetExternalKubeInformerFactory(externalInformers)
|
serviceAccountAdmission.SetExternalKubeInformerFactory(externalInformers)
|
||||||
|
|
||||||
masterConfig := framework.NewControlPlaneConfig()
|
controlPlaneConfig := framework.NewControlPlaneConfig()
|
||||||
masterConfig.GenericConfig.EnableIndex = true
|
controlPlaneConfig.GenericConfig.EnableIndex = true
|
||||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
|
controlPlaneConfig.GenericConfig.Authentication.Authenticator = authenticator
|
||||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizer
|
controlPlaneConfig.GenericConfig.Authorization.Authorizer = authorizer
|
||||||
masterConfig.GenericConfig.AdmissionControl = serviceAccountAdmission
|
controlPlaneConfig.GenericConfig.AdmissionControl = serviceAccountAdmission
|
||||||
_, _, kubeAPIServerCloseFn := framework.RunAnAPIServerUsingServer(masterConfig, apiServer, h)
|
_, _, kubeAPIServerCloseFn := framework.RunAnAPIServerUsingServer(controlPlaneConfig, apiServer, h)
|
||||||
|
|
||||||
// Start the service account and service account token controllers
|
// Start the service account and service account token controllers
|
||||||
stopCh := make(chan struct{})
|
stopCh := make(chan struct{})
|
||||||
|
@ -159,8 +159,8 @@ func newStatefulSetPVC(name string) v1.PersistentVolumeClaim {
|
|||||||
|
|
||||||
// scSetup sets up necessities for Statefulset integration test, including master, apiserver, informers, and clientset
|
// scSetup sets up necessities for Statefulset integration test, including master, apiserver, informers, and clientset
|
||||||
func scSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *statefulset.StatefulSetController, informers.SharedInformerFactory, clientset.Interface) {
|
func scSetup(t *testing.T) (*httptest.Server, framework.CloseFunc, *statefulset.StatefulSetController, informers.SharedInformerFactory, clientset.Interface) {
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
_, s, closeFn := framework.RunAnAPIServer(masterConfig)
|
_, s, closeFn := framework.RunAnAPIServer(controlPlaneConfig)
|
||||||
|
|
||||||
config := restclient.Config{Host: s.URL}
|
config := restclient.Config{Host: s.URL}
|
||||||
clientSet, err := clientset.NewForConfig(&config)
|
clientSet, err := clientset.NewForConfig(&config)
|
||||||
|
@ -336,13 +336,13 @@ func InitTestMaster(t *testing.T, nsPrefix string, admission admission.Interface
|
|||||||
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
|
|
||||||
if admission != nil {
|
if admission != nil {
|
||||||
masterConfig.GenericConfig.AdmissionControl = admission
|
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||||
}
|
}
|
||||||
|
|
||||||
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServerUsingServer(masterConfig, s, h)
|
_, testCtx.HTTPServer, testCtx.CloseFn = framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
||||||
|
|
||||||
if nsPrefix != "default" {
|
if nsPrefix != "default" {
|
||||||
testCtx.NS = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), s, t)
|
testCtx.NS = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), s, t)
|
||||||
|
@ -71,7 +71,7 @@ func initTestMaster(t *testing.T, nsPrefix string, admission admission.Interface
|
|||||||
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
controlPlaneConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||||
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
resourceConfig := controlplane.DefaultAPIResourceConfigSource()
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) {
|
||||||
resourceConfig.EnableVersions(schema.GroupVersion{
|
resourceConfig.EnableVersions(schema.GroupVersion{
|
||||||
@ -79,13 +79,13 @@ func initTestMaster(t *testing.T, nsPrefix string, admission admission.Interface
|
|||||||
Version: "v1alpha1",
|
Version: "v1alpha1",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
masterConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
controlPlaneConfig.ExtraConfig.APIResourceConfigSource = resourceConfig
|
||||||
|
|
||||||
if admission != nil {
|
if admission != nil {
|
||||||
masterConfig.GenericConfig.AdmissionControl = admission
|
controlPlaneConfig.GenericConfig.AdmissionControl = admission
|
||||||
}
|
}
|
||||||
|
|
||||||
_, testCtx.httpServer, testCtx.closeFn = framework.RunAnAPIServerUsingServer(masterConfig, s, h)
|
_, testCtx.httpServer, testCtx.closeFn = framework.RunAnAPIServerUsingServer(controlPlaneConfig, s, h)
|
||||||
|
|
||||||
if nsPrefix != "default" {
|
if nsPrefix != "default" {
|
||||||
testCtx.ns = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), s, t)
|
testCtx.ns = framework.CreateTestingNamespace(nsPrefix+string(uuid.NewUUID()), s, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user