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

Implement the "rewrite" middleware from distribution #21661

Open
adam-lebon opened this issue Feb 22, 2025 · 5 comments
Open

Implement the "rewrite" middleware from distribution #21661

adam-lebon opened this issue Feb 22, 2025 · 5 comments

Comments

@adam-lebon
Copy link

adam-lebon commented Feb 22, 2025

Is your feature request related to a problem? Please describe.
I use GoHarbor with MinIO as storage.

GoHarbor accesses MinIO using an internal network that is not accessible from the outside On the other hand, MinIO is publicly accessible using a load balancer, but this load balancer cannot be reached by Harbor.

Redirection has therefore been disabled in Harbor.

Describe the solution you'd like.
Last year, the “distribution” project implemented a new middleware called “rewrite”. It replaces the scheme and hostname returned to the client during a docker pull.

This seems to be the ideal solution to our problem since it should allow harbor to reach minio using the internal address while returning a public address to clients.

Describe the main design/architecture of your solution
The solution would be to implement this “rewrite” middleware like the cloudfront middleware.

distribution/distribution#4146

@adam-lebon adam-lebon changed the title Implement the "rewrite" middleware from distributiuon Implement the "rewrite" middleware from distribution Feb 22, 2025
@wy65701436
Copy link
Contributor

since the above pull request wasn't in the distribution v2.8.3, so currently Harbor cannot support it.

cc @Vad1mo did some testing on distribution v3, maybe he can share more infor.

@stonezdj
Copy link
Contributor

stonezdj commented Feb 26, 2025

You can disable registry redirect when the client can not access the minio.

see https://github.com/goharbor/harbor/blob/main/make/harbor.yml.tmpl#L82

@adam-lebon
Copy link
Author

Hello,
As stated in first message, it works if I disable redirects as you pointed out.

However, I'll be serving docker images to hundreds of client simultaneously, this is why I'm looking for lowering the stress applied to Harbor.

If I achieve to enable this rewrite middleware, the stress should be applied to minio instead of harbor+minio.

If I get some time during the next week I'll try to implement this middleware to harbor

@Vad1mo
Copy link
Member

Vad1mo commented Feb 26, 2025

You can use the v3 distribution rewrite middleware. according to

just replace the image from to upstream

@adam-lebon
Copy link
Author

I'm currently deploying harbor using the bitnami helm chart.
If I've understood correctly, I need to disable the harbor registry deployment, then replace it with the upstream distribution project ? @Vad1mo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants