provision

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package provision is funcd's TEMPORARY container-runtime self-provisioning (ADR-0056): `funcd install` downloads the pinned, SHA-256-verified static binaries the managed-containerd path needs — crun (the OCI runtime the runc-v2 shim execs), containerd (+ its runc-v2 shim + ctr), and the CNI plugins — laying crun/containerd into funcd's bin dir and the CNI plugins into /opt/cni/bin. It is the interim stand-in for ADR-0054's bundled-release embed; its exit criterion is shipping those bytes funcd built.

Security model (the load-bearing property): every asset is read FULLY into memory, its SHA-256 is compared to the pinned digest, and ONLY on a match is anything written/chmod'd to disk. A mismatch returns a fault.Invalid error having written nothing — no unverified bytes ever land on disk or run as root.

Stdlib only (no new Go module): net/http + crypto/sha256 + archive/tar + compress/gzip.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LayDown

func LayDown(ctx context.Context, binDir, cniDir string) error

LayDown downloads each pinned asset for the host arch, verifies its SHA-256 BEFORE any chmod/exec, then installs it. Idempotent: an asset already present at its pinned version is skipped. A checksum mismatch returns fault.Invalid and installs NOTHING (no partial state, no chmod, no exec). binDir/cniDir are the destinations.

func Plan

func Plan(binDir, cniDir string) []string

Plan returns the human-readable lay-down plan (asset → version, source URL, dest) for `funcd install --print`, for the HOST arch, by iterating the same assets table. Pure — no network, no disk.

Types

type Asset

type Asset struct {
	Name    string                   // "crun" | "containerd" | "cni-plugins"
	Version string                   // pinned, e.g. "1.28"
	URLFor  func(arch string) string // arch ∈ {"amd64","arm64"}
	SHA256  map[string]string        // arch → hex digest (verified before Install)
	Install func(data []byte, binDir, cniDir string) error
	// contains filtered or unexported fields
}

Asset is a pinned, checksum-verified downloadable runtime binary/tarball. Install is a PER-ASSET closure encoding the asset's shape — a lone binary (chmod 0755 into binDir), or an untar selecting named members to their dests. It runs ONLY after the SHA-256 of data matched the pin.

Jump to

Keyboard shortcuts

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