Repository navigation
Feat: scope plain HTTP to the listed registries (MK8S-451) - #77
Open
riadelhajjaji-scality wants to merge 6 commits into
Open
riadelhajjaji-scality wants to merge 6 commits into
riadelhajjaji-scality wants to merge 6 commits into
Conversation
riadelhajjaji-scality
force-pushed
the
improvement/MK8S-451-scope-plain-http
branch
from
November 17, 2026 14:15
b7e390a to
8333d2e
Compare
riadelhajjaji-scality
marked this pull request as ready for review
November 17, 2026 14:20
riadelhajjaji-scality
requested review from
eg-ayoub,
ezekiel-alexrod and
g-carre
November 17, 2026 14:20
1 of 2 tasks
--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.
A registry on HTTPS that redirects its blobs to storage on plain HTTP failed the pull. Only the pulled registry is held to HTTPS now: a redirect elsewhere is safe, each blob is checked against its digest.
The registries are named by their Service, so the library never tried plain HTTP for them. A source with the ClusterIP, a private address, stays pending unlisted and syncs once listed.
…MK8S-451) They were written in four places. DESIGN.md links to them, the flag help and the TLS godoc keep one line.
riadelhajjaji-scality
force-pushed
the
improvement/MK8S-451-scope-plain-http
branch
from
November 24, 2026 13:26
f108e11 to
5bb8cd5
Compare
ezekiel-alexrod
approved these changes
Nov 25, 2026
|
|
||
| By("creating an ImageCache that names the registry by its ClusterIP, unlisted") | ||
| worker := utils.WorkerNode() | ||
| applyImageCacheFrom(plainIPName, worker, host+"/e2e/carrier:1") |
Contributor
There was a problem hiding this comment.
nit: the other state a spec leaves behind (the registry-ca ConfigMap, the agent patch, the seeded directories) goes through DeferCleanup, but the ImageCache doesn't. If an assertion below fails, it stays, and so does its directory on the worker. I'd register its deletion right after this line, like the rest (go vet -tags e2e is fine with it):
DeferCleanup(func() {
_, _ = utils.Run(exec.Command("kubectl", "delete", "imagecache", plainIPName, "--ignore-not-found"))
})
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
--plain-httpmarked every registry insecure: 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, so a site with one plain HTTP registry and one signed by a private CA had no working setting.On top of that, go-containerregistry tries HTTP on its own for a private or loopback IP and a
localhostname, whatever we configure. An on-premises registry usually has such an address.Fix
--plain-httpis replaced by--plain-http-registry=<host[:port]>, repeatable, matched exactly against the sources' registry. Entries are validated and normalized at startup (docker.io→index.docker.io) and logged with a warning. It works with--ca-file, not with--insecure-skip-tls-verify.httpsOnlyinpuller.go): refuses a plain HTTP request to the pulled registry unless it is listed, so the library's own fallback can't reach it and a bad certificate fails the pull again. A redirect to another host, such as blob storage on plain HTTP, goes through: each blob is checked against its digest.imagecachectl import: keeps--plain-http, now scoped to the registry of its one source, through the same transport.agent/README.md;README.mdandagent/DESIGN.mdlink to them.--plain-httpand won't start with it. Pass--plain-http-registrywith the registry theImageCachesources name instead. A plain HTTP registry on a private or loopback IP or alocalhostname, which the library used to reach over HTTP unlisted, must now be listed too, andimagecachectl importneeds--plain-httpfor it.Test
make -C agent test,make -C agent lintlocalhostaddress is refused, no request reaches it--ca-fileaccepted,--insecure-skip-tls-verifyrefusedOut of scope
--plain-http-registry.README.md,agent/README.md,agent/DESIGN.md.Relates-to: #MK8S-451