Documentation
¶
Overview ¶
Package environment keeps the registry of managed containerd hosts (ADR-0006). MVP registers a single "local" environment backed by the containerd socket; remote agent-backed environments (#69, #70) implement the same runtime.Runtime interface.
Index ¶
Constants ¶
const (
KindLocal = "local"
)
Kinds of environments.
const LocalID = "local"
LocalID is the ID of the environment for the host nerdui runs on.
Variables ¶
var ErrDuplicate = errors.New("environment already registered")
ErrDuplicate is returned when an environment ID is already registered.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
ID string
Name string
Kind string
DefaultNamespace string
Runtime runtime.Runtime
// Events fans out the environment's containerd events; Run it for the server lifetime.
Events *events.Hub
}
Environment is a managed containerd host.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a concurrency-safe, ordered set of environments.
func NewRegistry ¶
func NewRegistry(envs ...*Environment) *Registry
NewRegistry returns a registry with envs in the given order. It panics on duplicate IDs.
func (*Registry) Get ¶
func (r *Registry) Get(id string) (*Environment, bool)
Get returns the environment with id.
func (*Registry) List ¶
func (r *Registry) List() []*Environment
List returns environments in registration order.