Documentation
¶
Overview ¶
Package workspaceseeds applies WorkspaceSeeds (admin.railgrid.ai) to every tenant workspace: backend functionality that is bound and set up without anyone enabling it.
Two controllers share a Store. The seed controller runs on the admin multicluster manager, validates each WorkspaceSeed and keeps the accepted ones in the Store. The workspace controller runs on the core multicluster manager, which engages every tenant workspace and serves its APIBindings, and brings each workspace to every seed in the Store whenever one of the workspace's bindings changes or the Store does.
Index ¶
- Constants
- func SetupSeedsWithManager(mgr mcmanager.Manager, store *Store) error
- func SetupWorkspacesWithManager(mgr mcmanager.Manager, clusters ClusterNamer, ops WorkspaceOps, store *Store) error
- func Validate(spec *adminv1alpha1.WorkspaceSeedSpec) error
- type ClusterNamer
- type Seed
- type Store
- type WorkspaceOps
Constants ¶
const ConditionAccepted = "Accepted"
ConditionAccepted is the WorkspaceSeed condition that says whether the hub applies the seed.
Variables ¶
This section is empty.
Functions ¶
func SetupSeedsWithManager ¶
SetupSeedsWithManager wires the seed controller into the admin multicluster manager, whose export serves the WorkspaceSeeds of root:railgrid:system:providers. Accepted seeds go into store.
func SetupWorkspacesWithManager ¶
func SetupWorkspacesWithManager(mgr mcmanager.Manager, clusters ClusterNamer, ops WorkspaceOps, store *Store) error
SetupWorkspacesWithManager wires the workspace controller into the core multicluster manager. Every tenant workspace binds core.railgrid.ai, whose virtual workspace serves the workspace's APIBindings, so the manager engages every tenant workspace and an APIBinding event is the signal that one exists or changed: a new workspace's core binding, a seeded binding turning Bound, a provider being enabled. A change of the Store fans out to every engaged workspace. There is no timer and no fleet walk.
func Validate ¶
func Validate(spec *adminv1alpha1.WorkspaceSeedSpec) error
Validate reports what the schema cannot: a spec the hub refuses to apply to tenant workspaces.
Types ¶
type ClusterNamer ¶
type ClusterNamer interface {
ClusterNames() []multicluster.ClusterName
}
ClusterNamer lists the logical clusters a multicluster provider currently engages. apiexportprovider.Provider.Clusters satisfies it.
type Seed ¶
type Seed struct {
Name string
Spec adminv1alpha1.WorkspaceSeedSpec
}
Seed is one accepted WorkspaceSeed.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the accepted seeds and tells its listeners when the set changes.
func (*Store) Delete ¶
Delete drops a seed. Nothing it created in any workspace is removed; workspaces simply stop being brought to it.
func (*Store) OnChange ¶
func (s *Store) OnChange(fn func()) (unregister func())
OnChange registers fn to run after every change of the set, on the goroutine that made the change. The returned function unregisters it.
func (*Store) Set ¶
func (s *Store) Set(name string, spec adminv1alpha1.WorkspaceSeedSpec)
Set records the accepted spec of a seed. Listeners run when it differs from what was held.
type WorkspaceOps ¶
type WorkspaceOps interface {
// ResolveClusterPath returns a logical cluster's workspace path.
ResolveClusterPath(ctx context.Context, clusterName string) (string, error)
// EnsureWorkspaceSeed brings one workspace to one seed.
EnsureWorkspaceSeed(ctx context.Context, clusterName, seedName string, spec adminv1alpha1.WorkspaceSeedSpec) (kcp.WorkspaceSeedResult, error)
}
WorkspaceOps is the slice of the kcp Bootstrapper the workspace controller writes through. *kcp.Bootstrapper satisfies it.