Repository navigation
feat(agent): pull through a registry mirror, then the source registry (MK8S-553) - #81
Draft
ezekiel-alexrod wants to merge 2 commits into
Draft
ezekiel-alexrod wants to merge 2 commits into
ezekiel-alexrod wants to merge 2 commits into
Conversation
--plain-http marked every registry insecure, so go-containerregistry raced HTTPS and HTTP for all of them: a registry serving HTTPS no longer failed on a bad certificate, and anyone on the path could answer the HTTP attempt. It also excluded --ca-file, leaving a site with one plain HTTP registry and one signed by a private CA with no working setting. Replace it on the agent with --plain-http-registry=<host[:port]>, repeatable. Only a source whose registry matches an entry exactly is marked insecure; every other registry stays HTTPS only. Entries are validated and normalized at startup and logged with a warning. The list goes with --ca-file and still excludes --insecure-skip-tls-verify. Marking a registry is not the only way the library reaches for HTTP: it also races HTTP on its own for a private or loopback IP address and for a localhost name, whatever the list says, and nothing turns that off. Every pull therefore goes through a transport that refuses a plain HTTP request to an unlisted registry before it leaves, so only the HTTPS attempt is left and a bad certificate fails the pull again. Without it, a registry on a private address, the usual case on premises, would be reached over plain HTTP listed or not. imagecachectl import keeps its --plain-http switch, now scoped to the registry of its single source, and goes through the same transport. BREAKING CHANGE: the agent no longer accepts --plain-http and refuses to start with it. Pass --plain-http-registry with the registry the ImageCache sources name instead. A plain HTTP registry on a private or loopback IP address or a localhost name, which the library used to reach over HTTP unlisted, must now be listed too, and imagecachectl import needs --plain-http for it.
The library has no mirror support, so a source had to name the registry address. With --mirror, a source keeps its real name, like ghcr.io/scality/x:1.0, and is pulled from <mirror>/scality/x:1.0 with ns=ghcr.io first, as containerd does. When the mirror fails, the registry the source names is tried, and the error carries both causes. The reference is rewritten rather than the host of each request, so --ca-file and --plain-http-registry apply to the mirror like to any registry. imagecachectl takes the same flag, and its --plain-http then goes to the mirror. Refs: MK8S-553
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
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.
Stacked on #77 (MK8S-451): the mirror goes through its plain HTTP list. I'll rebase on
mainonce #77 merges.Component
agent, docs
Problem
go-containerregistry has no mirror support. So today an
ImageCachesource has to carry the registry address, like<ip>:5000/metalk8s-<ver>/..., while containerd pullsghcr.io/scality/...and lets its mirror config redirect it. We want the same canonical name in theImageCacheresources.Fix
imagecachectl import: a--mirror=<host[:port]>flag. A sourceghcr.io/scality/x:1.0is pulled from<mirror>/v2/scality/x/...?ns=ghcr.iofirst, as containerd does, then fromghcr.ioif the mirror fails. When both fail, the error carries both causes.<mirror>/<repository>:<tag>(or@<digest>) and a small RoundTripper (withNamespace) only addsns. So the library picks the scheme for the real mirror host,--ca-fileand--plain-http-registryapply to it like to any registry, and errors name the mirror. Swapping the host in the transport would keep the HTTPS scheme ofghcr.ioand break with a plain HTTP mirror.imagecachectl: with--mirror,--plain-httpgoes to the mirror, not to the source's registry. On a node the mirror is the local registry without TLS, and the source names a real one that keeps HTTPS.ns=docker.io, like containerd. A source that already names the mirror is pulled once, with nons.Design: scality/citadel#399, section "Registry mirror".
The interesting part is
openandwithNamespaceinagent/internal/puller/puller.go. I'd like feedback on the approach and on theimagecachectl--plain-httpchoice.Test
make -C agent test,make -C agent lintgo test -raceonpullerandclins=<registry>, fallback, both failures in the error, digest reference, Docker Hubns, source on the mirror itself, CA applied to the mirror, unlisted mirror kept HTTPS only, invalid mirror refusedmake -C agent test-e2eon kind: source only on the mirror is synced, then the mirror is stopped and a secondImageCacheis synced from the registryOut of scope
--mirror(follow-up in metalk8s).README.md,agent/README.md,agent/DESIGN.md.Relates-to: MK8S-553