From db45852179dd5d38f26b732b92818a2e5d6858ab Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 7 Oct 2021 14:35:39 +0530 Subject: [PATCH] testenv: Add AddUser() to provision new user Add `Environment.AddUser()` to allow provisioning of new cluster user. Signed-off-by: Sunny --- runtime/testenv/testenv.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runtime/testenv/testenv.go b/runtime/testenv/testenv.go index 1fc4f265..b391d418 100644 --- a/runtime/testenv/testenv.go +++ b/runtime/testenv/testenv.go @@ -281,3 +281,13 @@ func (e *Environment) CreateNamespace(ctx context.Context, generateName string) } return ns, nil } + +// AddUser provisions a new user for connecting to this Environment. The user +// will have the specified name & belong to the specified groups. +// +// If a "base" config is specified, the returned REST Config will contain those +// settings as well as any required by the authentication method. It can also +// be used to specify options like QPS. +func (e *Environment) AddUser(user envtest.User, baseConfig *rest.Config) (*envtest.AuthenticatedUser, error) { + return e.env.AddUser(user, baseConfig) +}