registry

package
v0.6.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrganizationScope string = "all"
	PersonalScope     string = "personal"
	PrettyNameLabel   string = "workspaces.kcp.dev/pretty-name"
	InternalNameLabel string = "workspaces.kcp.dev/internal-name"
	PrettyNameIndex   string = "workspace-pretty-name"
	InternalNameIndex string = "workspace-internal-name"
)

Variables

View Source
var Strategy = workspaceStrategy{typerSchema, names.SimpleNameGenerator}

Strategy is the default logic that applies when creating and updating Project objects via the REST API.

Functions

func AddNameIndexers

func AddNameIndexers(crbInformer rbacinformers.ClusterRoleBindingInformer) error

func InternalListOptionsToSelectors

func InternalListOptionsToSelectors(options *metainternal.ListOptions) (labels.Selector, fields.Selector)

Types

type FilteredClusterWorkspaces added in v0.6.0

type FilteredClusterWorkspaces interface {
	workspaceauth.Lister
	workspaceauth.WatchableCache
	AddWatcher(watcher workspaceauth.CacheWatcher)
	Stop()
}

FilteredClusterWorkspaces allows to list and watch ClusterWorkspaces filtered by authorizaation, i.e. a user only sees those object he has access to.

type REST

type REST struct {
	rest.TableConvertor
	// contains filtered or unexported fields
}

func NewREST

func NewREST(
	cfg *clientrest.Config,
	rootTenancyClient tenancyclient.TenancyV1alpha1Interface,
	kubeClusterClient kubernetes.ClusterInterface,
	kcpClusterClient kcpclientset.ClusterInterface,
	clusterWorkspaceCache *workspacecache.ClusterWorkspaceCache,
	wilcardsCRBInformer rbacinformers.ClusterRoleBindingInformer,
	getFilteredClusterWorkspaces func(orgClusterName logicalcluster.Name) FilteredClusterWorkspaces,
) *REST

NewREST returns a RESTStorage object that will work against ClusterWorkspace resources in org workspaces, projecting them to the Workspace type.

func (*REST) Create

func (s *REST) Create(ctx context.Context, obj runtime.Object, createValidation rest.ValidateObjectFunc, options *metav1.CreateOptions) (runtime.Object, error)

Create creates a new workspace The workspace is created in the underlying KCP server, with an internal name since the name ( == pretty name ) requested by the user might already exist at the organization level. Internal names would be <pretty name>--<suffix>.

However, when the user manages his workspaces through the personal scope, the pretty names will always be used.

Personal pretty names and the related internal names are stored on the ClusterRoleBinding that links the ClusterWorkspace-related ClusterRole with the user Subject.

Typical actions done against the underlying KCP instance when

kubectl create workspace my-app

is issued by User-A against the virtual workspace at the personal scope:

  1. create ClusterRoleBinding owner-workspace-my-app-user-A

If this fails, then my-app already exists for the user A => conflict error.

  1. create ClusterRoleBinding owner-workspace-my-app-user-A create ClusterRole owner-workspace-my-app-user-A

  2. create ClusterWorkspace my-app

If this conflicts, create my-app--1, then my-app--2, …

  1. update RoleBinding user-A-my-app to point to my-app-2 instead of my-app.

  2. update ClusterRole owner-workspace-my-app-user-A to point to the internal workspace name update the internalName and pretty annotation on cluster roles and cluster role bindings.

func (*REST) Delete

func (s *REST) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, options *metav1.DeleteOptions) (runtime.Object, bool, error)

func (*REST) Destroy added in v0.6.0

func (s *REST) Destroy()

Destroy implements rest.Storage

func (*REST) Get

func (s *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)

Get retrieves a Workspace by name

func (*REST) List

func (s *REST) List(ctx context.Context, options *metainternal.ListOptions) (runtime.Object, error)

List retrieves a list of Workspaces that match label.

func (*REST) NamespaceScoped

func (s *REST) NamespaceScoped() bool

func (*REST) New

func (s *REST) New() runtime.Object

New returns a new ClusterWorkspace

func (*REST) NewList

func (*REST) NewList() runtime.Object

NewList returns a new ClusterWorkspaceList

func (*REST) Watch added in v0.6.0

func (s *REST) Watch(ctx context.Context, options *metainternal.ListOptions) (watch.Interface, error)

type RoleType

type RoleType string
const (
	OwnerRoleType RoleType = "owner"
)

type WorkspacesScopeKeyType

type WorkspacesScopeKeyType string
const (
	WorkspacesScopeKey WorkspacesScopeKeyType = "VirtualWorkspaceWorkspacesScope"
	WorkspacesOrgKey   WorkspacesScopeKeyType = "VirtualWorkspaceWorkspacesOrg"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL