image

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package image is the Go port of .lok8s/libs/image — pre-pull private images into the local cache registry.

Bridges the credential gap between the dev's docker host (which has upstream creds) and kind's containerd (which doesn't). Pulls `<endpoint>/<branch>/<svc>:<tag>` to the host, retags it to `lok8s.cache/<branch>/<svc>:<tag>`, pushes to the cache registry.

Reads its work list from clusters/<domain>/artifacts/.cache-queue, written by env.Kustomization for every service with build:false + resolved registry.endpoint. All docker/network access goes through injectable seams (Runner / HTTPGet) — tests never touch a live daemon.

Index

Constants

This section is empty.

Variables

View Source
var ErrHandled = ui.ErrHandled // one sentinel for every package; see internal/ui

ErrHandled marks a failure whose message was already printed in the bash [error] format; callers exit non-zero without printing anything further.

Functions

func CacheRegistry added in v0.5.0

func CacheRegistry(network string) string

CacheRegistry is the name of the cache registry's container and volume on the given docker network ("" is the default network, lok8s).

Types

type Context

type Context struct {
	Paths  *config.Paths
	Runner execx.Runner
	Out    io.Writer
	ErrOut io.Writer
	// Domain is the resolved active domain (bash:
	// `${domain:-${DOMAIN_NAME:-lok8s.dev}}`).
	Domain string
}

Context carries one image-command invocation.

func (*Context) Cache

func (c *Context) Cache(ctx context.Context, service string, force, all bool) error

Cache pre-pulls image(s) into the local cache registry (bash: image::cache). Without all, requires a service name and resolves it via the committed services.yaml + active config layer. With all, walks the .cache-queue file written by env.Kustomization.

Idempotent: skips if the cache registry already has a manifest matching the requested ref. force overrides the skip.

func (*Context) Clean

func (c *Context) Clean(ctx context.Context, network string) error

Clean drops everything from the cache registry by recreating its volume (bash: image::clean). network is the resolved KIND_EXPERIMENTAL_DOCKER_NETWORK (spec.network.name > env > "lok8s" — the entrypoint's ambient export).

func (*Context) List

func (c *Context) List(ctx context.Context) (int, error)

List shows what's currently in the cache registry (bash: image::list). The returned rc mirrors the bash function's exit status — notably curl's own code (7 on connection-refused) when the endpoint is unreachable, which pipefail propagated through `curl -s | jq .` and the raw re-fetch alike.

Jump to

Keyboard shortcuts

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