feat: add proxy_all_registries option to dfinit containerd module#1803
Merged
gaius-qi merged 3 commits intodragonflyoss:mainfrom Apr 22, 2026
Merged
feat: add proxy_all_registries option to dfinit containerd module#1803gaius-qi merged 3 commits intodragonflyoss:mainfrom
gaius-qi merged 3 commits intodragonflyoss:mainfrom
Conversation
dc2ba9d to
73bd060
Compare
Add a new dfinit containerd configuration option, proxyAllRegistries (default: true), that writes a catch-all `_default/hosts.toml` under the containerd config_path so registries not explicitly listed in `registries:` are still proxied through dfdaemon. The `_default` fallback omits both the top-level `server` field and the `X-Dragonfly-Registry` header; dfdaemon infers the upstream registry from the `ns=` query parameter that containerd appends when resolving via `_default` (support added in dragonflyoss#1792). Explicitly configured registries keep their own `hosts.toml` and take precedence over the catch-all. Closes dragonflyoss#1791. Signed-off-by: Jamal Allogie <jamal.allogie@gmail.com>
73bd060 to
b411bf8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1803 +/- ##
==========================================
+ Coverage 43.21% 43.47% +0.25%
==========================================
Files 92 92
Lines 26868 26972 +104
==========================================
+ Hits 11612 11726 +114
+ Misses 15256 15246 -10
🚀 New features to boost your workflow:
|
Signed-off-by: Gaius <gaius.qi@gmail.com>
Signed-off-by: Gaius <gaius.qi@gmail.com>
hhhhsdxxxx
approved these changes
Apr 22, 2026
imeoer
approved these changes
Apr 22, 2026
mingcheng
approved these changes
Apr 22, 2026
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.
Follow-up to #1792 / closes #1791.
Motivation
Without explicit per-registry configuration, containerd sends all pulls directly to upstream registries, bypassing dfdaemon. Listing every registry in
registries:ahead of time is impractical in environments where users can pull from arbitrary registries (e.g. Kubernetes clusters with ad-hoc image sources).Per @gaius-qi's suggestion in #1791, this adds a config option that enables proxying all registries through dfdaemon by writing a catch-all
_default/hosts.toml.Changes
proxyAllRegistries: booltodfinit::Containerd, defaulting totrue.<config_path>/_default/hosts.tomlpointing at dfdaemon, withcapabilities = ["pull", "resolve"]and no top-levelserver/X-Dragonfly-Registryheader — dfdaemon infers the upstream registry from thens=query parameter (support added in feat: infer upstream registry from containerd ns= query parameter #1792).registries:still get their ownhosts.tomlunder<host_namespace>/and take precedence over the_defaultfallback.config_pathpresent in containerd.toml, or injected by dfinit when missing).Example rendered config
Tests
Two new unit tests added alongside the existing
test_containerd_config_with_v2/v3_config_path:test_containerd_config_with_proxy_all_registries— asserts that both the explicitdocker.io/hosts.toml(withX-Dragonfly-Registryheader) and_default/hosts.toml(without header or server) are written whenproxy_all_registries: true.test_containerd_config_without_proxy_all_registries— asserts_default/hosts.tomlis absent when disabled.Existing v2/v3 tests were updated to set
proxy_all_registries: falseto preserve their original assertions.Compatibility notes
true, which is a behavior change for existing users on upgrade: installs that today rely on dfinit not touching registries outside the configured list will suddenly see all pulls routed through dfdaemon. Operators who need the old behavior can setproxyAllRegistries: falsein their dfinit YAML. Happy to flip the default tofalseif that's the project preference.Closes #1791.