Support remote images with images load subcommand#22
Merged
Conversation
…present
`y-cluster images load` accepts:
./... /... ~/... treat as local path
- file: an already-tarred OCI archive
- directory: an OCI v1 layout (tar
streamed on the fly, equivalent to
tar -cf - -C <dir> . | images load -)
- stdin (an OCI archive)
<anything else> remote image reference
For remote refs the default flow resolves the digest, checks the
cluster's k8s.io namespace, no-ops if already indexed, otherwise
pulls into the y-cluster shared cache (idempotent on digest, dedup
across cluster targets) and streams to ctr image import. The
skip-if-present check saves the SSH/docker-exec byte transfer on
re-deploys -- the biggest cost on the qemu backend.
--cache=false opts out of the persistent cache: pull into a
tempdir, load, throw the tempdir away. Rejected for path / stdin
input where the caller already owns the bytes.
Internal surface added:
- pkg/images.Export(ctx, ref, dir, logger) -- pull a ref to an
exact dir (sibling to Cache which writes to a derived path
under the shared cache root).
- pkg/images.ResolveDigest(ctx, ref) -- digest resolution without
pulling blobs; digest input is offline-safe, tag input HEADs.
- pkg/images.TarOCIDir(dir, w) / TarOCIDirReader(dir) -- stream
the USTAR archive ctr image import accepts.
- pkg/images.PresentInCluster(ctx, lr, digestRef) -- matches the
digest column in ctr image list, ignoring ref-name differences
(mirrors, retag) so the cluster-side dedup is content-keyed.
- pkg/cache.ImageLayout(flagOverride, digest) -- single source of
truth for "where does a given digest's layout live", so a
future cache-backend swap (e.g. embedded registry:3 in 2.0)
touches one helper, not every caller.
- Cache now logs "image cached" at info level on write success,
symmetric with "pulling image" / "image already cached" --
one info entry per network pull, one per cache hit, one per
import. Grep-friendly for sideload scripts.
Tests:
- pkg/images: Export round-trip via random.Image + httptest
registry (asserts returned digestRef matches img.Digest()
exactly, not just shape); digest-pinned input preserved
verbatim with no extra HEAD (verifiable in registry request
trace); ResolveDigest digest pass-through + tag HEAD error;
registry.k8s.io/pause:3.10 network test (-short skips).
- pkg/images: TarOCIDir streamer end-to-end (random.Image ->
Export -> TarOCIDir -> tar.Reader) confirms every required
OCI layout entry reaches the archive; empty-dir + missing-dir
+ pipe-close cases.
- pkg/images: PresentInCluster digest-match policy isolated.
- cmd/y-cluster: TestIsPathArg pins the dispatch rule against
every reference shape we ship; --cache=false rejection for
stdin and path input is asserted before any kubeconfig is
consulted (so misuse errors don't get masked by a missing
context).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
solsson
pushed a commit
to Yolean/ystack
that referenced
this pull request
May 12, 2026
Bumps host bin (bin/y-bin.runner.yaml) and the in-cluster y-kustomize Deployment image across four consecutive y-cluster releases: - v0.4.2: `images load` accepts remote refs (Yolean/y-cluster#22) - v0.4.3: fix `images load` for digest-only refs (Yolean/y-cluster#23) - v0.4.4: `images list --context=<ctx>` subcommand (Yolean/y-cluster#24) and tunable Gateway API resource requests (Yolean/y-cluster#25) - v0.4.5: re-fix digest-only image tagging and gateway resource requests (Yolean/y-cluster#26) Image digest verified via `crane digest ghcr.io/yolean/y-cluster:v0.4.5`. sha256 sums copied from v0.4.5's checksums.txt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.