-
Notifications
You must be signed in to change notification settings - Fork 70
Add OCI distribution-spec registry proxying support #561
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -71,6 +71,11 @@ type Endpoint struct { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // This can only be set in a registry's Mirror field, not in the registry's primary Endpoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // This per-mirror setting is allowed only when mirror-by-digest-only is not configured for the primary registry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PullFromMirror string `toml:"pull-from-mirror,omitempty"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // NamespaceProxy enables OCI distribution-spec registry proxying. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // When set, an "ns" query parameter with this value is appended to all requests, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // allowing a single proxy to route to multiple upstream registries. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // See https://github.com/opencontainers/distribution-spec/blob/main/spec.md#registry-proxying | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+74
to
+77
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // NamespaceProxy enables OCI distribution-spec registry proxying. | |
| // When set, an "ns" query parameter with this value is appended to all requests, | |
| // allowing a single proxy to route to multiple upstream registries. | |
| // See https://github.com/opencontainers/distribution-spec/blob/main/spec.md#registry-proxying | |
| // NamespaceProxy corresponds to the `namespace-proxy` configuration field and | |
| // enables OCI distribution-spec registry proxying. | |
| // | |
| // When set, the value is used as the namespace and an `ns` query parameter | |
| // with this value is appended to all requests sent to the endpoint. This | |
| // allows a single proxy registry to route to multiple upstream registries | |
| // based on the `ns` value, as defined by the OCI distribution-spec | |
| // registry proxying extension. | |
| // | |
| // Example configuration (TOML) for a proxy registry that can route to | |
| // multiple upstream registries: | |
| // | |
| // [[registry]] | |
| // prefix = "proxy.example.com" | |
| // | |
| // # Images under proxy.example.com/registry1/* are forwarded to | |
| // # an upstream that interprets ns=registry1 | |
| // [[registry.mirror]] | |
| // location = "proxy.example.com" | |
| // namespace-proxy = "registry1" | |
| // | |
| // # Images under proxy.example.com/registry2/* are forwarded to | |
| // # a different upstream that interprets ns=registry2 | |
| // [[registry.mirror]] | |
| // location = "proxy.example.com" | |
| // namespace-proxy = "registry2" | |
| // | |
| // For the full specification, see: | |
| // https://github.com/opencontainers/distribution-spec/blob/main/spec.md#registry-proxying |
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.
The test suite should include a test case that verifies the behavior when the path already contains query parameters. This is important because the search functionality (lines 466-470 in docker_client.go) can pass paths with existing query parameters like "?last=xyz&n=100" from pagination links. A test case should verify that the namespace proxy parameter is correctly appended to existing parameters, for example: path "/v2/_catalog?last=xyz&n=100" with namespaceProxy "docker.io" should result in "/v2/_catalog?last=xyz&n=100&ns=docker.io" (or with parameters in a different order since url.Values.Encode() doesn't guarantee order).