Feat: enable mtls in harbor replication

Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
DQ 2020-02-12 19:01:59 +08:00
parent 40e67f3b14
commit b852605193
3 changed files with 13 additions and 2 deletions

View File

@ -347,7 +347,7 @@ def parse_yaml_config(config_file_path, with_notary, with_clair, with_trivy, wit
external_database=config_dict['external_database'])
if config_dict['internal_tls'].enabled:
config_dict['registry_url']: 'https://registry:5443'
config_dict['registry_url'] = 'https://registry:5443'
config_dict['registry_controller_url'] = 'https://registryctl:8443'
config_dict['core_url'] = 'https://core:8443'
config_dict['core_local_url'] = 'https://127.0.0.1:8443'

View File

@ -26,7 +26,9 @@ import (
"github.com/goharbor/harbor/src/common/http/modifier"
common_http_auth "github.com/goharbor/harbor/src/common/http/modifier/auth"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/jobservice/config"
"github.com/goharbor/harbor/src/pkg/registry/auth/basic"
adp "github.com/goharbor/harbor/src/replication/adapter"
"github.com/goharbor/harbor/src/replication/adapter/native"
"github.com/goharbor/harbor/src/replication/model"
@ -68,7 +70,12 @@ type adapter struct {
}
func newAdapter(registry *model.Registry) (*adapter, error) {
transport := util.GetHTTPTransport(registry.Insecure)
var transport *http.Transport
if registry.URL == config.GetCoreURL() {
transport = common_http.GetHTTPTransport(common_http.InternalTransport)
} else {
transport = util.GetHTTPTransport(registry.Insecure)
}
// local Harbor instance
if registry.Credential != nil && registry.Credential.Type == model.CredentialTypeSecret {
authorizer := common_http_auth.NewSecretAuthorizer(registry.Credential.AccessSecret)

View File

@ -17,6 +17,10 @@ package native
import (
"errors"
"fmt"
"sync"
"sync"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/internal"