Documentation
¶
Index ¶
- Variables
- func AdmitWorkspaceAccess(ctx context.Context, t *testing.T, ...)
- func ConfigWithToken(token string, cfg *rest.Config) *rest.Config
- func ExportVirtualWorkspaceURLs(export *apisv1alpha1.APIExportEndpointSlice) []string
- func KcpCliPluginCommand() []string
- func Kubectl(t *testing.T, kubeconfigPath string, args ...string) []byte
- func KubectlApply(t *testing.T, kubeconfigPath string, input []byte) []byte
- func NewOrganizationFixture(t *testing.T, server kcptestingserver.RunningServer, ...) (logicalcluster.Path, *tenancyv1alpha1.Workspace)deprecated
- func NewRootShardOrganizationFixture[O kcptesting.WorkspaceOption](t *testing.T, server kcptestingserver.RunningServer, options ...O) (logicalcluster.Path, *tenancyv1alpha1.Workspace)
- func ReplicationVirtualWorkspaceURLs(slice *cachev1alpha1.CachedResourceEndpointSlice) []string
- func RunKcpCliPlugin(t *testing.T, kubeconfigPath string, subcommand []string) []byte
- func StaticTokenUserConfig(username string, cfg *rest.Config) *rest.Config
- func Suite(t *testing.T, suite string)
- func UniqueGroup(suffix string) string
- func VirtualWorkspaceURL(ctx context.Context, kcpClusterClient kcpclientset.ClusterInterface, ...) (string, bool, error)
- func WithRequiredGroups(groups ...string) testing2.PrivilegedWorkspaceOption
- type ArtifactFunc
Constants ¶
This section is empty.
Variables ¶
var DefaultTokenAuthFile string
DefaultTokenAuthFile returns the default auth tokens file.
Functions ¶
func AdmitWorkspaceAccess ¶ added in v0.6.0
func AdmitWorkspaceAccess(ctx context.Context, t *testing.T, kubeClusterClient kcpkubernetesclientset.ClusterInterface, clusterName logicalcluster.Path, users []string, groups []string, admin bool)
AdmitWorkspaceAccess create RBAC rules that allow the given users and/or groups to access the given workspace, optionally as admin.
func ConfigWithToken ¶ added in v0.6.0
ConfigWithToken returns a copy of the given rest.Config with the given token set.
func ExportVirtualWorkspaceURLs ¶ added in v0.11.0
func ExportVirtualWorkspaceURLs(export *apisv1alpha1.APIExportEndpointSlice) []string
ExportVirtualWorkspaceURLs returns the URLs of the virtual workspaces of the given APIExportEndpointSlice.
func KcpCliPluginCommand ¶ added in v0.6.0
func KcpCliPluginCommand() []string
KcpCliPluginCommand returns the cli args to run the workspace plugin directly or via go run (depending on whether NO_GORUN is set).
func Kubectl ¶ added in v0.6.0
Kubectl runs kubectl with the given arguments and returns the combined stderr and stdout.
func KubectlApply ¶ added in v0.6.0
KubectlApply runs kubectl apply -f with the supplied input piped to stdin and returns the combined stderr and stdout output.
func NewOrganizationFixture
deprecated
added in
v0.6.0
func NewOrganizationFixture(t *testing.T, server kcptestingserver.RunningServer, options ...kcptesting.UnprivilegedWorkspaceOption) (logicalcluster.Path, *tenancyv1alpha1.Workspace)
NewOrganizationFixture creates a workspace under root.
Deprecated: use NewWorkspaceFixture with WithType(core.RootCluster.Path(), "organization") instead. There is no organization concept in kcp.
func NewRootShardOrganizationFixture ¶ added in v0.27.0
func NewRootShardOrganizationFixture[O kcptesting.WorkspaceOption](t *testing.T, server kcptestingserver.RunningServer, options ...O) (logicalcluster.Path, *tenancyv1alpha1.Workspace)
NewRootShardOrganizationFixture creates an organization workspace on the root shard.
func ReplicationVirtualWorkspaceURLs ¶ added in v0.28.0
func ReplicationVirtualWorkspaceURLs(slice *cachev1alpha1.CachedResourceEndpointSlice) []string
ReplicationVirtualWorkspaceURLs returns the URLs of the virtual workspaces of the given CachedResourceEndpointSlice.
func RunKcpCliPlugin ¶ added in v0.6.0
RunKcpCliPlugin runs the kcp workspace plugin with the provided subcommand and returns the combined stderr and stdout output.
func StaticTokenUserConfig ¶ added in v0.11.0
StaticTokenUserConfig returns a user config based on static user tokens defined in "test/e2e/framework/auth-tokens.csv". The token being used is "[username]-token".
func Suite ¶ added in v0.10.0
Suite should be called at the very beginning of a test case, to ensure that a test is only run when the suite containing it is selected by the user running tests.
func UniqueGroup ¶ added in v0.7.0
UniqueGroup returns a unique API group with the given suffix by prefixing some random 8 character base36 string. suffix must start with a dot if the random string should be dot-separated.
func VirtualWorkspaceURL ¶ added in v0.11.0
func VirtualWorkspaceURL(ctx context.Context, kcpClusterClient kcpclientset.ClusterInterface, ws *tenancyv1alpha1.Workspace, urls []string) (string, bool, error)
VirtualWorkspaceURL returns the virtual workspace URL base URL of the shard the workspace is scheduled on.
func WithRequiredGroups ¶ added in v0.11.0
func WithRequiredGroups(groups ...string) testing2.PrivilegedWorkspaceOption
WithRequiredGroups is a privileged action, so we return a privileged option type, and only the helpers that use the system:master config can consume this. However, workspace initialization requires a valid user annotation on the workspace object to impersonate during initialization, and system:master bypasses setting that, so we end up needing to hard-code something conceivable.