provider

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: 26 Imported by: 0

Documentation

Overview

Package provider populates the tenancy directory from the tenant workspaces bound to the tenancy APIExport. It is the read side of the operator: the same discovery (multicluster-runtime over the apiexport endpoint slice), but instead of materializing workspaces it only mirrors Tenant, Project and Membership objects into the in-memory directory the virtual workspace answers from.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts Options, dir *directory.Directory) error

Run fills dir until ctx is cancelled. It marks the directory ready once cluster discovery has synced, so reviews are never answered from a half-built index.

Types

type Clusters

type Clusters struct {
	// contains filtered or unexported fields
}

Clusters hands out a client for one logical cluster in the fleet.

An APIExport's virtual workspace runs per shard: the endpoint slice lists one URL for each shard serving the export, and each of those URLs serves only the clusters that live on that shard. So there is no single URL a write can be addressed to. Asking a shard about a cluster it does not host is refused as a plain Forbidden — that shard has no APIBinding for the cluster, and the virtual workspace's authorizer anonymizes the reason, so the answer is indistinguishable from the caller having no standing at all.

The read side already solves this: the provider watches every URL the slice publishes and knows which endpoint each cluster was discovered through. Clusters exposes that, so a write goes to the shard that actually holds the workspace rather than to whichever URL happened to be listed first.

func NewClusters

func NewClusters() *Clusters

NewClusters returns a Clusters that Run fills in.

func (*Clusters) Platform

func (c *Clusters) Platform(ctx context.Context, cluster string) (client.Client, error)

Platform returns a client for a workspace in the platform tier, which is where Tenant records live.

func (*Clusters) Tenancy

func (c *Clusters) Tenancy(ctx context.Context, cluster string) (client.Client, error)

Tenancy returns a client for a tenant workspace, which is where Projects and Memberships live.

type Options

type Options struct {
	// RestConfig reaches the kcp shard hosting the tenancy APIExports.
	RestConfig *rest.Config
	// PlatformSlice serves Tenants, TenancySlice serves Projects and
	// Memberships. They are different exports because they live in
	// different tiers, so the directory is fed by two managers.
	PlatformSlice string
	TenancySlice  string
	// Clusters, when non-nil, is filled with a handle on the two managers,
	// so the caller can address a write to the shard that hosts a given
	// workspace. See the type for why that is not a free choice.
	Clusters *Clusters
}

Options configures the directory provider.

Jump to

Keyboard shortcuts

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