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

Harbor Registry endpoint is redirecting to hardcoded URL #20594

Open abhishek-anand-hpe opened 2 months ago

abhishek-anand-hpe commented 2 months ago

Expected behavior and actual behavior: I have two harbor instances

I am trying to create a replication policy on harbor2 to replicate some artifacts from harbor1. To create replication policy first I am trying to create a registry endpoint (pointing to harbor1)

Steps to reproduce the problem: I am running below curl command from my setup where both harbor1 and harbor2 are reachable

curl -X 'POST'  https://harbor.stxxx.cgw-hpe.net/api/v2.0/registries  -H 'accept: application/json'   -H 'Content-Type: application/json'   -d '{
  "credential": {
    "access_key": "admin",
    "access_secret": "xxxxx",
    "type": "basic"
  },
  "name": "test",
  "url": "https://harbor-lb.cgw-hpe.net",
  "insecure": true,
  "type": "harbor",
  "description": "test"
}' -k -u "admin:xxxxx"

It is giving me 504 or 400 error. When I check the logs of harbor-core pod, I get below error MicrosoftTeams-image (6)

From the error it looks like it is redirecting the request from 'https://harbor-lb.cgw-hpe.net' to 'https://harbor.cgw-hpe.net', and that is strange as we are not explicitly harcoding or specifying "harbor" instead of "harbor-lb" anywhere in our code.

Versions:

zyyw commented 2 months ago

Are you able to create the registry endpoint pointing to Harbor1 from the Harbor portal of Harbor 2, instead of using the API call ?

divya-prakash2 commented 2 months ago

same issue faced when trying to create a registry endpoint from Harbor portal as well @zyyw . Looking at the logs from harbor-core pod we have seen that it is trying to point to a different URL ( harbor.cgw-hpe.net instead of harbor-lb.cgw-hpe.net )

zyyw commented 2 months ago

could you please try to set externalURL to harbor-lb.cgw-hpe.net (for harbor1)?

github-actions[bot] commented 3 weeks ago

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.