Documentation
¶
Overview ¶
Package cli implements tenancyctl, the day-to-day client for the tenancy model: provisioning organization workspaces, creating tenants and projects, granting and revoking access, and asking the virtual workspace what the caller can reach.
It is deliberately a separate binary from the server: an administrator runs it with a kubeconfig, and an end user runs `whoami`/`kubeconfig` with nothing but their own credential and the virtual workspace's URL.
Index ¶
- func CachedToken() string
- func ClearSelection() error
- func Execute() error
- func New(use string) *cobra.Command
- func NewAdminCommand() *cobra.Command
- func NewKubeconfigCommand() *cobra.Command
- func NewLoginCommand() *cobra.Command
- func NewLogoutCommand() *cobra.Command
- func NewMembershipCommand() *cobra.Command
- func NewProjectsCommand() *cobra.Command
- func NewSeedCommand() *cobra.Command
- func NewTenantsCommand() *cobra.Command
- func NewUseCommand() *cobra.Command
- func NewWhoAmICommand() *cobra.Command
- func WriteSelection(s Selection) error
- type Selection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CachedToken ¶
func CachedToken() string
CachedToken returns the token `login` cached in the default location, or "" when there is none, it expired, or more than one provider is cached.
func ClearSelection ¶
func ClearSelection() error
ClearSelection forgets where the user was working, but keeps them logged in and keeps the server: they chose a project, not a cluster.
func New ¶
New builds the tenancy CLI command tree under the given name — "tenancyctl" for the standalone binary, "tenancy" when mounted as a subcommand of the repo-wide CLI. It registers no logging flags; the binary that owns the process does that once, at its own root.
func NewAdminCommand ¶
NewAdminCommand groups everything that writes to kcp with a kubeconfig rather than answering from the caller's own credential: creating tenants and projects, bootstrapping an organization, seeding an environment. Whoever runs the platform uses these; a tenant does not.
func NewKubeconfigCommand ¶
NewKubeconfigCommand writes a kubeconfig for the caller's projects.
func NewLoginCommand ¶
NewLoginCommand obtains a token from the identity provider and caches it.
func NewLogoutCommand ¶
NewLogoutCommand forgets the cached token.
func NewMembershipCommand ¶
NewMembershipCommand groups the grant lifecycle under one noun: `membership` lists, `membership add` grants, `membership remove` revokes.
Unlike the user-facing commands, these need a kubeconfig for kcp: a Membership lives in its tenant's workspace, which is the record store no member can enter, so managing access is an administrator's job by construction rather than by a check.
func NewProjectsCommand ¶
NewProjectsCommand lists the projects the caller can reach.
func NewSeedCommand ¶
NewSeedCommand exposes seed for the tenancy binary, so a development environment (Tilt, a demo) can converge on baseline data with the component's own tooling and nothing else.
func NewTenantsCommand ¶
NewTenantsCommand lists the tenants the caller is a member of.
func NewUseCommand ¶
NewUseCommand selects the tenant and project later commands default to.
func NewWhoAmICommand ¶
NewWhoAmICommand shows the tenants and projects the caller can reach.
func WriteSelection ¶
WriteSelection stores the selection, leaving the rest of the context — the server, the TLS settings — as it was.
Types ¶
type Selection ¶
type Selection struct {
Tenant string
Project string
// URL is the project's workspace, as the virtual workspace reported
// it, so commands that only need somewhere to talk to do not have to
// ask again.
URL string
}
Selection is the tenant and project the user is currently working in: what `use` picks, and what every command that needs a workspace falls back to when no flag names one.
It is a view onto the shared CLI context in ~/.kube, which also holds the server `login` learned — one file, so a command never has to be told twice where anything is.
func CurrentSelection ¶
func CurrentSelection() Selection
CurrentSelection reads the selection from the shared context.