mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
Part of master to controlplane in test/integration
Rename NewIntegrationTestMasterConfig to NewIntegrationTestControlPlaneConfig
This commit is contained in:
@@ -55,7 +55,7 @@ func alwaysAlice(req *http.Request) (*authenticator.Response, bool, error) {
|
||||
}
|
||||
|
||||
func TestSubjectAccessReview(t *testing.T) {
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -146,7 +146,7 @@ func TestSubjectAccessReview(t *testing.T) {
|
||||
|
||||
func TestSelfSubjectAccessReview(t *testing.T) {
|
||||
username := "alice"
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(func(req *http.Request) (*authenticator.Response, bool, error) {
|
||||
return &authenticator.Response{
|
||||
User: &user.DefaultInfo{Name: username},
|
||||
@@ -229,7 +229,7 @@ func TestSelfSubjectAccessReview(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLocalSubjectAccessReview(t *testing.T) {
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator.RequestFunc(alwaysAlice)
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = sarAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
|
@@ -440,7 +440,7 @@ func getTestRequests(namespace string) []struct {
|
||||
// TODO(etune): write a fuzz test of the REST API.
|
||||
func TestAuthModeAlwaysAllow(t *testing.T) {
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
defer closeFn()
|
||||
|
||||
@@ -537,7 +537,7 @@ func getPreviousResourceVersionKey(url, id string) string {
|
||||
|
||||
func TestAuthModeAlwaysDeny(t *testing.T) {
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysDenyAuthorizer()
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
defer closeFn()
|
||||
@@ -586,7 +586,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
||||
// This file has alice and bob in it.
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -655,7 +655,7 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
||||
// should receive "Forbidden".
|
||||
func TestBobIsForbidden(t *testing.T) {
|
||||
// This file has alice and bob in it.
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -699,7 +699,7 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
|
||||
// This file has alice and bob in it.
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -761,7 +761,7 @@ func (impersonateAuthorizer) Authorize(ctx context.Context, a authorizer.Attribu
|
||||
|
||||
func TestImpersonateIsForbidden(t *testing.T) {
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = impersonateAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -908,7 +908,7 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
|
||||
trackingAuthorizer := &trackingAuthorizer{}
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = trackingAuthorizer
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -974,7 +974,7 @@ func TestNamespaceAuthorization(t *testing.T) {
|
||||
`)
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -1072,7 +1072,7 @@ func TestKindAuthorization(t *testing.T) {
|
||||
`)
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -1156,7 +1156,7 @@ func TestReadOnlyAuthorization(t *testing.T) {
|
||||
a := newAuthorizerWithContents(t, `{"readonly": true}`)
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = getTestTokenAuth()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = a
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
@@ -1233,7 +1233,7 @@ func testWebhookTokenAuthenticator(customDialer bool, t *testing.T) {
|
||||
}
|
||||
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = allowAliceAuthorizer{}
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
|
@@ -117,7 +117,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
|
||||
|
||||
authenticator := bearertoken.New(bootstrap.NewTokenAuthenticator(bootstrapSecrets{test.secret}))
|
||||
// Set up a master
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = authenticator
|
||||
_, s, closeFn := framework.RunAMaster(masterConfig)
|
||||
defer closeFn()
|
||||
|
@@ -519,7 +519,7 @@ func TestRBAC(t *testing.T) {
|
||||
|
||||
for i, tc := range tests {
|
||||
// Create an API Server.
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||
@@ -642,7 +642,7 @@ func TestRBAC(t *testing.T) {
|
||||
func TestBootstrapping(t *testing.T) {
|
||||
superUser := "admin/system:masters"
|
||||
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||
@@ -703,7 +703,7 @@ func TestDiscoveryUpgradeBootstrapping(t *testing.T) {
|
||||
|
||||
superUser := "admin/system:masters"
|
||||
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = newRBACAuthorizer(t, masterConfig)
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(tokenfile.New(map[string]*user.DefaultInfo{
|
||||
superUser: {Name: "admin", Groups: []string{"system:masters"}},
|
||||
|
@@ -83,7 +83,7 @@ func TestServiceAccountTokenCreate(t *testing.T) {
|
||||
gcs := &clientset.Clientset{}
|
||||
|
||||
// Start the server
|
||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||
masterConfig := framework.NewIntegrationTestControlPlaneConfig()
|
||||
masterConfig.GenericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer()
|
||||
masterConfig.GenericConfig.Authentication.APIAudiences = aud
|
||||
masterConfig.GenericConfig.Authentication.Authenticator = bearertoken.New(
|
||||
|
Reference in New Issue
Block a user