Documentation
¶
Index ¶
- Constants
- Variables
- func AddNameIndexers(crbInformer rbacinformers.ClusterRoleBindingInformer) error
- func InternalListOptionsToSelectors(options *metainternal.ListOptions) (labels.Selector, fields.Selector)
- func NewREST(tenancyClient tenancyclient.TenancyV1alpha1Interface, ...) (*REST, *KubeconfigSubresourceREST)
- type KubeConfig
- type KubeconfigSubresourceREST
- func (s *KubeconfigSubresourceREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
- func (s *KubeconfigSubresourceREST) NamespaceScoped() bool
- func (r *KubeconfigSubresourceREST) New() runtime.Object
- func (r *KubeconfigSubresourceREST) ProducesMIMETypes(verb string) []string
- func (r *KubeconfigSubresourceREST) ProducesObject(verb string) interface{}
- type REST
- func (s *REST) Create(ctx context.Context, obj runtime.Object, ...) (runtime.Object, error)
- func (s *REST) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, bool, error)
- func (s *REST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
- func (s *REST) List(ctx context.Context, options *metainternal.ListOptions) (runtime.Object, error)
- func (s *REST) NamespaceScoped() bool
- func (s *REST) New() runtime.Object
- func (*REST) NewList() runtime.Object
- type RoleType
- type WorkspacesScopeKeyType
Constants ¶
const ( OrganizationScope string = "organization" 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 ¶
var ScopeSets sets.String = sets.NewString(PersonalScope, OrganizationScope)
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)
func NewREST ¶
func NewREST(tenancyClient tenancyclient.TenancyV1alpha1Interface, kubeClient kubernetes.Interface, crbInformer rbacinformers.ClusterRoleBindingInformer, workspaceReviewerProvider workspaceauth.ReviewerProvider, workspaceLister workspaceauth.Lister) (*REST, *KubeconfigSubresourceREST)
NewREST returns a RESTStorage object that will work against Workspace resources
Types ¶
type KubeConfig ¶
type KubeConfig string
func (KubeConfig) DeepCopyObject ¶
func (obj KubeConfig) DeepCopyObject() runtime.Object
func (KubeConfig) GetObjectKind ¶
func (obj KubeConfig) GetObjectKind() schema.ObjectKind
func (KubeConfig) InputStream ¶
func (s KubeConfig) InputStream(ctx context.Context, apiVersion, acceptHeader string) (stream io.ReadCloser, flush bool, contentType string, err error)
InputStream returns a stream with the contents of the URL location. If no location is provided, a null stream is returned.
type KubeconfigSubresourceREST ¶
type KubeconfigSubresourceREST struct {
// contains filtered or unexported fields
}
func (*KubeconfigSubresourceREST) Get ¶
func (s *KubeconfigSubresourceREST) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)
Get retrieves a Workspace KubeConfig by workspace name
func (*KubeconfigSubresourceREST) NamespaceScoped ¶
func (s *KubeconfigSubresourceREST) NamespaceScoped() bool
func (*KubeconfigSubresourceREST) New ¶
func (r *KubeconfigSubresourceREST) New() runtime.Object
New creates a new Workspace log options object
func (*KubeconfigSubresourceREST) ProducesMIMETypes ¶
func (r *KubeconfigSubresourceREST) ProducesMIMETypes(verb string) []string
ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE, PATCH) can respond with.
func (*KubeconfigSubresourceREST) ProducesObject ¶
func (r *KubeconfigSubresourceREST) ProducesObject(verb string) interface{}
ProducesObject returns an object the specified HTTP verb respond with. It will overwrite storage object if it is not nil. Only the type of the return object matters, the value will be ignored.
type REST ¶
type REST struct {
rest.TableConvertor
// contains filtered or unexported fields
}
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 Workspace-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:
- create ClusterRoleBinding owner-workspace-my-app-user-A
If this fails, then my-app already exists for the user A => conflict error.
create ClusterRoleBinding owner-workspace-my-app-user-A create ClusterRole owner-workspace-my-app-user-A create ClusterRole lister-workspace-my-app-user-A (in order to later allow sharing)
create Workspace my-app
If this conflicts, create my-app--1, then my-app--2, …
update RoleBinding user-A-my-app to point to my-app-2 instead of my-app.
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) 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 ¶
type WorkspacesScopeKeyType ¶
type WorkspacesScopeKeyType string
const WorkspacesScopeKey WorkspacesScopeKeyType = "VirtualWorkspaceWorkspacesScope"