bootstrap

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package bootstrap installs the kcp-side objects the tenancy component needs: the four APIExports and their endpoint slices, the two WorkspaceTypes that bind the capability exports into provisioned workspaces, and the platform tier's own bindings.

Workspace-path plumbing is shared with the access component (access/pkg/bootstrap); this package only owns the tenancy assets.

Index

Constants

View Source
const (
	// ExportPlatform serves Tenants in the platform workspace.
	ExportPlatform = "tenancy-platform"
	// ExportTenancy serves Projects and Memberships in tenant workspaces.
	ExportTenancy = "tenancy"
	// ExportProvisioner grants the claim to create workspaces.
	ExportProvisioner = "tenancy-provisioner"
	// ExportAccess grants the claims to write inside a project workspace.
	ExportAccess = "tenancy-access"
)

The four exports. Each has an endpoint slice of the same name, and the operator runs one manager per slice — which is how "this controller may only do this" becomes structural rather than conventional.

View Source
const (
	WorkspaceTypeTenant  = "tenant"
	WorkspaceTypeProject = "project"
)

The workspace types the operator provisions with.

View Source
const (
	DefaultWorkspacePrefix      = "root:tenancy"
	DefaultControllersWorkspace = "controllers"

	// DefaultStoreWorkspace is the registry: the workspace Tenant records
	// live in. It is deliberately not the workspace they are provisioned
	// under, so nothing that can create a workspace can also rewrite the
	// records that say which workspaces should exist.
	DefaultStoreWorkspace = "store"

	// DefaultTenantsWorkspace is the provisioning parent: every tenant
	// workspace is created as its child. It holds no tenancy objects at
	// all.
	DefaultTenantsWorkspace = "tenants"
)

Defaults for where things are installed.

Variables

This section is empty.

Functions

func BindStore

func BindStore(ctx context.Context, cfg *rest.Config, result *Result, opts Options) error

BindStore makes the workspace cfg points at the tenant registry: it binds tenancy-platform, then waits until Tenants are actually servable.

func BindTenantsParent

func BindTenantsParent(ctx context.Context, cfg *rest.Config, result *Result, opts Options) error

BindTenantsParent makes the workspace cfg points at the provisioning parent: it binds tenancy-provisioner, so tenant workspaces can be created as its children.

There is nothing to wait for here — the claim adds no servable API, it adds reach — so a readiness probe would have nothing to probe.

The operator creates tenant workspaces under this one through the provisioner export, which addresses clusters and not paths, so the server identities get the same locator role as in the store.

func GrantPlatformAdmins

func GrantPlatformAdmins(ctx context.Context, cfg *rest.Config, users, groups []string) error

GrantPlatformAdmins makes the given identities administrators of the tenant registry cfg points at: they may enter it and manage Tenants, and nothing else. It is applied even with no identities, so that dropping someone from the list revokes them.

func WaitForEndpointSliceURLs

func WaitForEndpointSliceURLs(ctx context.Context, cfg *rest.Config, sliceName string) ([]string, error)

WaitForEndpointSliceURLs reports the virtual workspace URLs one endpoint slice has published. kcp fills a slice only once a workspace binds the export, so this is worth calling after binding, not before. An empty answer is informational, never fatal: the operator follows the slice and picks URLs up as they appear.

Types

type Options

type Options struct {
	// ServerUsers and ServerGroups are additional identities granted the
	// server role in the exports workspace — the identities the operator
	// and the virtual workspace authenticate as when they are not this
	// bootstrap's own credential.
	ServerUsers  []string
	ServerGroups []string
}

Options configures Bootstrap.

type Result

type Result struct {
	// ExportsPath is the canonical path of the workspace holding the
	// exports, and ExportsCluster its logical cluster name.
	ExportsPath    string
	ExportsCluster string
	// WorkspacesIdentityHash is the identity of kcp's tenancy.kcp.io
	// export, which every claim on `workspaces` must repeat.
	WorkspacesIdentityHash string
}

Result reports what Bootstrap installed.

func Bootstrap

func Bootstrap(ctx context.Context, cfg *rest.Config, exportsPath string, opts Options) (*Result, error)

Bootstrap applies the exports workspace's assets into the workspace cfg points at. Idempotent: safe to run on every pod start and every upgrade.

Jump to

Keyboard shortcuts

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