From 2171634000b0e8d72d3e1ff9625d63dbf2325fff Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Tue, 7 Apr 2020 21:27:06 +0800 Subject: [PATCH] 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 --- src/replication/adapter/harbor/base/adapter.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/replication/adapter/harbor/base/adapter.go b/src/replication/adapter/harbor/base/adapter.go index f3d66fd51..81ba23f29 100644 --- a/src/replication/adapter/harbor/base/adapter.go +++ b/src/replication/adapter/harbor/base/adapter.go @@ -33,18 +33,11 @@ import ( // New creates an instance of the base adapter func New(registry *model.Registry) (*Adapter, error) { 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) httpClient := common_http.NewClient(&http.Client{ Transport: common_http.GetHTTPTransport(common_http.SecureTransport), }, authorizer) - client, err := NewClient(url, httpClient) + client, err := NewClient(registry.URL, httpClient) if err != nil { return nil, err } @@ -52,7 +45,7 @@ func New(registry *model.Registry) (*Adapter, error) { Adapter: native.NewAdapterWithAuthorizer(registry, authorizer), Registry: registry, Client: client, - url: url, + url: registry.URL, httpClient: httpClient, }, nil }