mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-29 13:57:33 +02:00
Fix replication bug
Remove the URL replacing logic temporarily to make replication work and will introduce a new solution for the hairpin issue Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
1c8d5c6df5
commit
2171634000
@ -33,18 +33,11 @@ import (
|
|||||||
// New creates an instance of the base adapter
|
// New creates an instance of the base adapter
|
||||||
func New(registry *model.Registry) (*Adapter, error) {
|
func New(registry *model.Registry) (*Adapter, error) {
|
||||||
if isLocalHarbor(registry) {
|
if isLocalHarbor(registry) {
|
||||||
// when the adapter is created for local Harbor, returns the "http://127.0.0.1:8080"
|
|
||||||
// as URL to avoid issue https://github.com/goharbor/harbor-helm/issues/222
|
|
||||||
// when harbor is deployed on Kubernetes
|
|
||||||
url := "http://127.0.0.1:8080"
|
|
||||||
if common_http.InternalTLSEnabled() {
|
|
||||||
url = "https://127.0.0.1:8443"
|
|
||||||
}
|
|
||||||
authorizer := common_http_auth.NewSecretAuthorizer(registry.Credential.AccessSecret)
|
authorizer := common_http_auth.NewSecretAuthorizer(registry.Credential.AccessSecret)
|
||||||
httpClient := common_http.NewClient(&http.Client{
|
httpClient := common_http.NewClient(&http.Client{
|
||||||
Transport: common_http.GetHTTPTransport(common_http.SecureTransport),
|
Transport: common_http.GetHTTPTransport(common_http.SecureTransport),
|
||||||
}, authorizer)
|
}, authorizer)
|
||||||
client, err := NewClient(url, httpClient)
|
client, err := NewClient(registry.URL, httpClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -52,7 +45,7 @@ func New(registry *model.Registry) (*Adapter, error) {
|
|||||||
Adapter: native.NewAdapterWithAuthorizer(registry, authorizer),
|
Adapter: native.NewAdapterWithAuthorizer(registry, authorizer),
|
||||||
Registry: registry,
|
Registry: registry,
|
||||||
Client: client,
|
Client: client,
|
||||||
url: url,
|
url: registry.URL,
|
||||||
httpClient: httpClient,
|
httpClient: httpClient,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user