Documentation
¶
Overview ¶
Package ctrmanager brings up the container runtime funcd will drive (ADR-0054). It is the seam between funcd's self-contained model and the containerd driver: Ensure returns the containerd socket the driver should dial.
Two modes, one Config:
- ExternalSocket set (--containerd <socket>): Ensure returns that socket as-is and starts NO child — funcd defers to the operator's existing system/Docker-style containerd. This is the cross-platform, unit-testable path.
- ExternalSocket "" (default): Ensure starts + supervises a PRIVATE containerd child on a funcd-private socket + data-root, lays down crun for the runc-v2 shim, and imports the embedded curated images (client.Import). This is REAL Go but only runs on Linux+root (containerd + crun + cgroups); off Linux it returns a clear error telling the operator to pass --containerd. It is exercised only in the deferred integration lane (FUNCD_IT=1, root — the ADR-0011/0032 precedent).
Close stops the supervised child (no-op for the external path).
Index ¶
Constants ¶
const FuncdRoot = "/var/lib/funcd"
FuncdRoot is funcd's runtime root — the value the install command + the Manager already use. The laid-down binaries live in BinDir (a sibling of the Manager's <root>/containerd data-root).
Variables ¶
This section is empty.
Functions ¶
func BinDir ¶
func BinDir() string
BinDir is the SINGLE source of truth for funcd's laid-down runtime binaries (crun, containerd, its shim, ctr): `funcd install`/provision.LayDown writes here and the Manager's resolveBin reads here, so install can never lay binaries where the Manager won't look (ADR-0056).
Types ¶
type Config ¶
type Config struct {
// ExternalSocket is the --containerd <socket> / FUNCD_CONTAINERD_SOCKET value. "" ⇒
// funcd starts + supervises its own private containerd.
ExternalSocket string
// DataRoot is the private containerd state dir (e.g. /var/lib/funcd/containerd) — used
// only on the private-managed path.
DataRoot string
// ImageOverride maps a runtime to a registry ref (--image runtime=ref) that ImageFor yields in
// place of the curated image and the containerd driver pulls (Pullable).
ImageOverride map[string]string
}
Config selects + configures the runtime bring-up (the composition root supplies it).
func (Config) ImageFor ¶ added in v0.3.0
ImageFor is the runtime→image mapping the containerd execution runs (funcd.WithContainerExecution): a runtime's ImageOverride ref when set, else the curated prefix+runtime+":latest".
func (Config) Pullable ¶ added in v0.3.0
Pullable reports whether the containerd driver may pull ref, an image that is not embedded (containerd.Config.Pullable). A runtime image is pulled only from a registry the operator chose: an ImageOverride entry or a custom prefix. With config.DefaultImagePrefix only the embedded images are used, so a runtime in neither the embed nor the override is a fault.NotFound (ADR-0054).
type Manager ¶
type Manager interface {
// Ensure returns the containerd socket the driver should dial: it starts + supervises a
// private containerd (default) and imports the embedded images, OR returns ExternalSocket
// as-is when --containerd is set. crun is laid down so the runc-v2 shim finds it. ctx bounds the
// start-up only: a private containerd runs until Close.
Ensure(ctx context.Context) (socket string, err error)
// Exited is closed once the private containerd has exited, so the driver's Close need not dial its socket to find
// out; nil for the external-socket path and before Ensure started one.
Exited() <-chan struct{}
// Close stops a supervised private containerd; a no-op for the external-socket path.
Close() error
}
Manager brings up the container runtime and yields the socket the driver dials.
func New ¶
New builds a Manager for cfg.
- ExternalSocket set ⇒ an external-socket Manager (cross-platform: Ensure returns the socket, starts no child, Close is a no-op).
- ExternalSocket "" ⇒ the private-managed Manager (Linux+root; non-Linux returns the "private containerd is Linux-only; pass --containerd <socket>" error from Ensure).