goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.61k stars 4.72k forks source link

setup proxy cache to Google Artifact registry is failing #20682

Open vinay1203 opened 2 months ago

vinay1203 commented 2 months ago

I have installed harbor and setup ingress and added a proxy registry with Google GCR provider but with Artifact registry as the Endpoint URL(https://us-docker.pkg.dev/).

But when i am trying to pull from the harbor endpoint, it is giving the below error. Error response from daemon: unknown: repository proxy-cache/prod-docker-us/hello-world not found

Docker login works and i am using the command in the format as below: docker pull ///hello-world:latest

And i was able to pull the image from GAR successfully using Google Artifact Registry endpoint.

After checking the harbor-core pod logs, i could see the below logs: 2024-07-01T19:43:19Z [ERROR] [/server/middleware/repoproxy/proxy.go:121]: failed to proxy manifest, fallback to local, request uri: /v2/proxy-cache/hello-world/manifests/latest, error: http status code: 405, body:

stonezdj commented 2 months ago

The google container registry (GCR) is different with the google artifact registry (GAR), you can not use the GCR provider for a GAR endpoint.

vinay1203 commented 1 month ago

So, GAR proxy is not currently supported by Harbor?

I used GCR provider with GAR endpoint with reference to the comment in the below PR. https://github.com/goharbor/harbor/issues/16973#issuecomment-1245674764

I also tried GAR endpoint with docker registry provider as well. It is also failing with the same error.

I am using harbor core image version of v2.10.2

kenny1G commented 1 month ago

So, GAR proxy is not currently supported by Harbor?

I used GCR provider with GAR endpoint with reference to the comment in the below PR. #16973 (comment)

I also tried GAR endpoint with docker registry provider as well. It is also failing with the same error.

I am using harbor core image version of v2.10.2

@vinay1203 You want to configure the replication endpoint in this way: https://github.com/goharbor/harbor/issues/16973#issuecomment-1245938649

vinay1203 commented 1 month ago

Hello @Kenny1G

Thank you for your response. I did follow the same PR but while creating a registry and giving Endpoint URL as "https://us-docker.pkg.dev" it is not letting me create the registry stating "the registry is unhealthy".

Upon checking harbor core logs, i can see the below errors: 2024-07-16T17:58:52Z [ERROR] [/pkg/reg/adapter/native/adapter.go:126]: failed to ping registry https://us-docker.pkg.dev: http status code: 401, body: {"errors":[{"code":"UNAUTHORIZED","message":"authentication failed"}]}

But if i add my project at the end of the url like "https://us-docker.pkg.dev/" then i am able to create the registry. That is the reason why i used Endpoint URL in that particular format ignoring the comment in the PR.

warroyo commented 1 month ago

I was seeing this issue as well and switching the registry endpoint to just the base path https://us-docker.pkg.dev without the project path on it works for setting up the proxy cache

stonezdj commented 1 month ago

when you set the endpoint to https://us-docker.pkg.dev/, the registry status might turn into unhealthy, then the proxy cache associate with this endpoint doesn’t work. (edited)

krab-skunk commented 2 weeks ago

is it officially supported or no ? I see no mention in official documentation, Harbor cannot skip one of the biggest registry out there