Skip to content
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

question: Would you consider this enhancement? #1873

Open
aceeric opened this issue Feb 3, 2024 · 4 comments
Open

question: Would you consider this enhancement? #1873

aceeric opened this issue Feb 3, 2024 · 4 comments
Labels
lifecycle/stale question Further information is requested

Comments

@aceeric
Copy link

aceeric commented Feb 3, 2024

Crane Maintainers: One of the things you can do with containerd mirroring is configure containerd to pass headers to the mirrored registry. This is useful if the mirror is itself caching pull-through registry. So: the in-cluster workload asks containerd to pull docker.io/hello-world:latest, then containerd mirrors that to my-caching-pullthruregistry.svc.cluster.local and sends it header "X-Registry=docker.io". Then the caching pull through registry: 1) inspects its cache, 2) determines it does not have hello-world:latest, 3) looks at header "X-Registry" and 4) does a pull of docker.io/hello-world:latest, adding it to cache and returning that image to containerd.

To interact with the pull through registry and test / validate this behavior, it would be nice if the crane utility supported an arg like --header=HEADER=VALUE. Example:

crane pull localhost:8080/hello-world:latest --header X-Registry=docker.io.

As I've been hacking around in the code it appears to me that this would be isolated to:

  1. cmd/crane/cmd/pull.go to add the flag,
  2. pkg/v1/remote/fetcher.go to receive the flag and add the header if specified
  3. the layers in between

Before I would put in the effort and submit a PR I first wanted to see if this is something you would consider including in the baseline.

Thank you.

@aceeric aceeric added the question Further information is requested label Feb 3, 2024
@imjasonh
Copy link
Collaborator

imjasonh commented Feb 4, 2024

That seems useful, yeah.

I wonder if a --header flag would be useful at the root command, so that every command gets it "for free" instead of having to add it to each command individually. This would mean things like crane pull, crane mutate, crane export would also be able to be configured to send headers.

@aceeric
Copy link
Author

aceeric commented Feb 8, 2024

I defer to the maintainers. My purpose for the new flag is to drive a pull through registry. In order to test it - the pull through registry needs to honor the header so - that makes it tough to test unless I also signed up to modify the pkg/registry code to implement pull-through using the header which is a substantial bit of work I would think...

@aceeric
Copy link
Author

aceeric commented Feb 11, 2024

Actually - containerd appends ?ns= as a query parameter when mirroring is configured. So maybe rather than a header, the various REST API calls could have the namespace appended just like containerd does... Then crane would be behaving identically to containerd. In that case the arg would be something other than --header

Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Keep fresh with the 'lifecycle/frozen' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants