-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add HostsFromHostDir() to remotes/docker/config #10141
Conversation
`remotes/docker/config` package provides `ConfigureHosts()` and `HostDirFromRoot()` functions only. But, its caller cannot know the actual hosts from a host. It causes that the caller cannot call `ConfigureHosts()` method with its proper Credentials. e.g. containerd/nerdctl#2844 - "nerdctl pull from private registry mirror is missing Authorization header" Signed-off-by: Min Uk Lee <minuk.dev@gmail.com>
Hi @minuk-dev. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Can you explain further the case this is trying to solve for. We are intentionally not supporting pre-fetching of the auth credentials to avoid credentials being passed to the wrong hosts. What is the information missing to get the correct credentials for the mirror? |
(It's only on nerdctl. I don't know other program's scenario.) In the containerd/nerdctl#2844's description, When I configured like below
and
And when I request to pull the image
harbor.example.com:8443 .But the Authorizer in RegistryHost is configured for gcr.io .So Credentials() (
gcr.io .
In other words, |
The point of using a callback is that this can be dynamically looked up when requested from the registry. It seems odd that nerdctl would pre-fetch just to return it in the closure, is there any specific reason it does this or was just originally done that way? |
In order to make Or, containerd/core/remotes/docker/authorizer.go Lines 65 to 77 in 2ec82c4
|
related: containerd/nerdctl#2844
remotes/docker/config
package providesConfigureHosts()
andHostDirFromRoot()
functions only.ConfigureHosts()
method with its proper Credentials.HostsFromHostDir()
, nerdctl can find the proper credential for a image.e.g.
https://github.com/containerd/nerdctl/blob/40fe8b6211b0ec3cc200fe53512b557559701a29/pkg/imgutil/dockerconfigresolver/dockerconfigresolver.go#L116-L122