images

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package images decides where ate-setup gets container images from.

The manifests name images as ko:// import paths, which ko builds and publishes on every install. That needs a checkout, a Go toolchain, and a registry to push to. Installing an already-published release instead means mapping those same references onto images that exist, which is what Source describes and Prebuilt performs.

Index

Constants

View Source
const ModulePath = "github.com/agent-substrate/substrate"

ModulePath is this repository's module path. A ko:// reference is it joined with a component's package.

Variables

View Source
var Components = []string{
	"cmd/ateapi",
	"cmd/atecontroller",
	"cmd/atelet",
	"cmd/atenet",
	"cmd/ateom-gvisor",
	"cmd/ateom-microvm",
	"cmd/credential-provider/kubernetes-secrets",
	"cmd/podcertcontroller",
	"demos/counter",
	"demos/egress",
	"demos/multi-template/fspersist",
	"demos/sandbox",
}

Components is every package the installer can deploy a published image for, as an import path within the module.

The list is closed on purpose. A reference that is not in it names something this build has no published image for, and failing beats guessing at a name that was never pushed. TestComponentsCoverTheManifests keeps it in step with the manifests, which is half of it: a new component also has to be published under the same repository and tag as the rest before a pre-built install can use it.

Functions

func BuildDockerfileImage added in v0.2.0

func BuildDockerfileImage(ctx context.Context, rootDir, dockerRepo, imageName, contextPath, koDefaultPlatforms string, extraFlags []string) (string, error)

BuildDockerfileImage builds a Dockerfile-based image from contextPath, pushes it to dockerRepo/<imageName>, and returns the digest-pinned reference. extraFlags are passed to docker buildx build, e.g. --cache-from/--cache-to.

The image is tagged with the build time only to give buildx a stable name to push to; the returned reference always uses the digest, so a stale tag can never be resolved by accident.

func ImageName

func ImageName(pkg string) string

ImageName is the image name pkg is published under: the last element of the import path, which is ko's --base-import-paths naming. ko lowercases it as well, which changes nothing while every package here already is.

This only describes reality because every ko invocation asks for that naming — internal/ko passes the flag, and the Makefile passes it as KO_NAMING. ko's own default appends an md5 of the full import path, which nothing here can reproduce, so a build that loses the flag publishes images no --image-repo install can find.

func KoReference

func KoReference(pkg string) string

KoReference is the ko:// reference the manifests name pkg by.

ko resolves a manifest reference as written, so a "./"-relative import path works there too. Naming packages in full is this repository's convention rather than ko's rule, and only the full form maps to an image here: TestComponentsCoverTheManifests holds the convention, and a reference spelled any other way fails the install rather than resolving.

func RemoteDigest

func RemoteDigest(ctx context.Context, ref string) (string, error)

RemoteDigest asks ref's registry which manifest the tag names.

One HEAD request per image, needing only read access. A localhost registry is contacted over plain HTTP, which is what the Kind local registry serves.

Types

type Digester

type Digester func(ctx context.Context, ref string) (string, error)

Digester resolves a tagged image reference to the digest its tag currently names, in "sha256:..." form. Prebuilt takes one so tests can rewrite manifests without a registry.

type Prebuilt

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

Prebuilt rewrites ko:// references to point at already-published images.

It is the drop-in counterpart to ko.Runner: same two methods, no builds, no registry writes, and no repository checkout beyond the manifests themselves. What it does need is read access to the registry, to pin each tag to a digest.

func NewPrebuilt

func NewPrebuilt(src Source, digest Digester) *Prebuilt

NewPrebuilt returns a resolver for an already-published image set. digest turns a tag into the image it names; callers outside tests pass RemoteDigest.

func (*Prebuilt) Pin added in v0.3.0

func (p *Prebuilt) Pin(ctx context.Context, image string) (string, error)

Pin returns the reference to install an image by: its tag, and the digest that tag currently names.

Rewriting a manifest pins every ko:// reference it finds. Pin is also for an image the manifests do not name by ko:// reference because ko does not build it, such as envoy-dataplane: a release publishes that under the same repository and tag as the rest, so it is found the same way.

The digest is not decoration. An ActorTemplate's container image, an image volume's reference, and a SandboxConfig's pauseImage each carry the CEL rule self.contains('@'), so a tag on its own is rejected by admission and every demo would fail to deploy. Pinning also restores what ko gave the control plane deployments for free: an install that cannot shift under a tag someone moves later. Keeping the tag alongside the digest is ko's own output shape, and leaves the reference legible in `kubectl get`.

func (*Prebuilt) ResolveBytes

func (p *Prebuilt) ResolveBytes(ctx context.Context, manifest []byte) ([]byte, error)

ResolveBytes rewrites an in-memory manifest, such as kustomize output.

func (*Prebuilt) ResolvePath

func (p *Prebuilt) ResolvePath(ctx context.Context, path string) ([]byte, error)

ResolvePath rewrites the manifests a path covers.

type Source

type Source struct {
	// Repo is the registry path holding the component images, without a
	// trailing slash, e.g. "registry.example.com/substrate".
	Repo string
	// Tag is the tag every component image carries. Releases tag all
	// components together, so one tag covers the set.
	Tag string
}

Source describes where images come from.

The zero value builds and publishes them from source with ko. Setting Repo switches to images already published in a registry, and ko is never invoked.

func (Source) Describe

func (s Source) Describe() string

Describe renders the source for the install log.

func (Source) IsPrebuilt

func (s Source) IsPrebuilt() bool

IsPrebuilt reports whether images should be pulled rather than built.

Jump to

Keyboard shortcuts

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