-
-
Notifications
You must be signed in to change notification settings - Fork 106
add "ns" query param to registry mirror requests #976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this needs to compare hostnames, since it's possible for two configs to point to the same hostname. For testing, that will require spinning up a second httptest Server to get a unique hostname (different port number).
Note, this is associated with opencontainers/distribution-spec#66 and in the future I'm going to want to add some default proxy settings that would check the OCI-Namespace
header in the responses. But that shouldn't stop this from moving forward.
internal/reghttp/http.go
Outdated
} | ||
if h != reqHost { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if h != reqHost { | |
if h.Config.Hostname != reqHost.config.Hostname { |
internal/reghttp/http.go
Outdated
} | ||
if h != reqHost { | ||
query.Set("ns", reqHost.config.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query.Set("ns", reqHost.config.Name) | |
query.Set("ns", reqHost.config.Hostname) |
Signed-off-by: Will Jordan <will.jordan@gmail.com>
f717a1f
to
afcbc05
Compare
Updated the PR with the suggested change and an updated test, please take a look. Thanks for linking the associated issue, I knew it was an established convention but wasn't aware of the ongoing discussion for inclusion in the distribution spec. My specific use-case is for compatibility with a Spegel mirror which was mentioned in that thread. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Fixes issue
N/A (I didn't create a separate issue)
Describe the change
Adds a
ns
query param to registry mirror requests. This matches the behavior of Containerd's own Registry Host Namespace implementation, and has become a common convention in registry-server implementations providing mirror functionality.How to verify it
Perform a registry request against a configured mirror (where the host does not match the namespace), and verify that the request includes the
ns
query parameter corresponding to the namespace.Changelog text
Please verify and check that the pull request fulfills the following requirements