Repository navigation
feat(agent): pull through a registry mirror, then the source registry (MK8S-553) - #81
Open
ezekiel-alexrod wants to merge 8 commits into
Open
ezekiel-alexrod wants to merge 8 commits into
ezekiel-alexrod wants to merge 8 commits into
Conversation
ezekiel-alexrod
force-pushed
the
improvement/MK8S-553-registry-mirror
branch
from
November 23, 2026 14:02
3534b53 to
2a7c6b1
Compare
riadelhajjaji-scality
force-pushed
the
improvement/MK8S-451-scope-plain-http
branch
from
November 24, 2026 13:26
f108e11 to
5bb8cd5
Compare
Base automatically changed from
improvement/MK8S-451-scope-plain-http
to
main
November 26, 2026 12:45
ezekiel-alexrod
force-pushed
the
improvement/MK8S-553-registry-mirror
branch
from
November 26, 2026 13:35
2a7c6b1 to
c8de007
Compare
The image cache could only pull a reference that names the registry address. This describes one global mirror, tried before the registry the source names, as containerd does, so the ImageCache sources keep the real image name. The next commits implement it. Refs: MK8S-553
Both ways to build a Remote checked the plain HTTP list on their own. The mirror adds a second registry to check, so the two now share withRegistries. No change in behaviour. Refs: MK8S-553
With a mirror, a source keeps its real name, like ghcr.io/scality/x:1.0, and is pulled from <mirror>/scality/x:1.0 first, with ns=ghcr.io on the registry API requests, as containerd does. When the mirror fails, the registry the source names is tried, and when both fail the error carries both causes. The mirror reference is built from the mirror registry, so a short host name stays the registry, and the mirror goes through the same TLS and plain HTTP settings as any registry. Refs: MK8S-553
The layers stream after the mirror is picked. A mirror that served the manifest but missed a layer then failed the pull on every pass, and the registry was never tried. A pull now sends a HEAD for each layer before it picks the mirror. The adoption check reads no layer, so it does not. Refs: MK8S-553
When the registry serves the image after the mirror failed, nothing failed, so there is no error to return. Without a log, a mirror that always fails goes unnoticed until the node loses the registry too. It is logged through the logr logger of the context, and agent/AGENTS.md notes this one exception to "packages return errors". Refs: MK8S-553
The agent takes the mirror as a flag and logs it at startup. Its README says what the flag does and points to the design for the rest. Refs: MK8S-553
A spec pulls a source the registry does not hold through the mirror, then falls back on the registry when the mirror loses a layer and when it is stopped, and checks the agent logs the mirror it passed over. registryHost names the test registries in one place, and deployRegistry enables deletes so a spec can remove a blob without a restart. Refs: MK8S-553
imagecachectl import takes the same mirror. Its --plain-http then goes to the mirror, and pairs with --ca-file, which covers the registry the source names. The command warns about a mirror it passed over, and names the mirror in its plain HTTP warning. Refs: MK8S-553
ezekiel-alexrod
force-pushed
the
improvement/MK8S-553-registry-mirror
branch
from
November 27, 2026 09:25
44e25d7 to
1482aab
Compare
ezekiel-alexrod
marked this pull request as ready for review
November 27, 2026 09:26
ezekiel-alexrod
requested review from
TeddyAndrieux,
anthony-treuillier-scality,
g-carre and
riadelhajjaji-scality
and removed request for
g-carre
November 27, 2026 09:26
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.
Component
agent, docs
Problem
go-containerregistry has no mirror support. So today an
ImageCachesource must carry the registry address, like<ip>:5000/metalk8s-<ver>/.... containerd pullsghcr.io/scality/...and lets its mirror config redirect it. We want the same real name in theImageCacheresources.Fix
A
--mirror=<host[:port]>flag on the agent and onimagecachectl import. A sourceghcr.io/scality/x:1.0is pulled from<mirror>/v2/scality/x/...?ns=ghcr.iofirst, like containerd does, then fromghcr.ioif the mirror fails. When both fail, the error gives both causes.Review guide: please read the commits in order, each one builds and passes its tests.
agent/DESIGN.md("Image pulling"). It says what the next commits do, and what the mirror is trusted for.open,onMirrorandwithNamespaceinagent/internal/puller/puller.go. This is where I'd like most of the feedback.agent/AGENTS.mdnotes this exception.imagecachectl.Design in citadel: scality/citadel#399, section "Registry mirror".
Test
make -C agent test lint,go test -racemake -C agent test-e2e: mirror first, then the registry when the mirror misses a layer or is stoppedAcceptance run on kind with a real static-oci-registry
The agent DaemonSet, with static-oci-registry (
main) on the host as a TLS mirror, CA through the shippedregistry-capatch:ghcr.io/...source, by tag and by digest: synced through the mirror,ns=ghcr.ioon each request, the sentinel keeps the real source.ghcr.iorefused: pending with both causes, then synced once the layer is back.imagecachectlon the worker node, mirror given as an IP, then adopted by the agent: the adoption asked the mirror for one manifest and the config, no layer.Out of scope
--mirror(follow-up in metalk8s).Known limits
nswith a port (NAME_INVALID), so a source registry with a port cannot use it as a mirror. Sources likeghcr.io/...are fine.README.md,agent/README.md,agent/DESIGN.md,agent/AGENTS.md.Relates-to: MK8S-553