Documentation
¶
Overview ¶
Package selftenantrequest lets a caller with nothing get their first tenant.
It closes the one gap that made the model unusable for a new person: every other self-service path here is authorized against a Membership, and someone who has just signed in has none. There is no login hook to hang this on either — the OIDC redirect goes from the browser to the identity provider and back, and this server only ever sees the resulting token on ordinary requests — so a new user has to ask for a tenant explicitly. That is deliberate rather than a limitation: provisioning as a side effect of a read would make listing tenants a write, and a monitoring probe would materialize workspaces.
Because there is no Membership to check, the gate is configuration: self-service is off unless the deployment turns it on, and can be restricted to groups the identity provider asserts. A deployment that leaves it off is not broken — it has decided that handing out tenants is an administrator's job.
The caller names the tenant and nothing else. The first admin is the caller, set here rather than read from the request, so nobody can ask for a tenant administered by someone else.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateTenantFunc ¶
type CreateTenantFunc func(ctx context.Context, tenant *tenancyv1alpha1.Tenant) (created bool, err error)
CreateTenantFunc creates a Tenant in the store workspace. The server supplies it, because where the records live is a deployment detail.
type Options ¶
type Options struct {
// Enabled turns self-service on. Off means the resource answers that
// it is not offered here, which is a decision rather than a failure.
Enabled bool
// Groups, when set, restricts self-service to callers in at least one
// of them — the groups the identity provider asserts, as kcp sees
// them. Empty means any authenticated caller.
Groups []string
}
Options configures who may ask.
type REST ¶
type REST struct {
// contains filtered or unexported fields
}
REST answers SelfTenantRequest creates.
func NewREST ¶
func NewREST(opts Options, create CreateTenantFunc) *REST
func (*REST) Create ¶
func (r *REST) Create(ctx context.Context, obj runtime.Object, _ rest.ValidateObjectFunc, _ *metav1.CreateOptions) (runtime.Object, error)
Create makes the tenant, with the caller as its first admin.