feat: 镜像仓库增加harbor类型

This commit is contained in:
wangzhengkun
2021-11-18 15:48:05 +08:00
parent 5103fe14e8
commit 7874ed3d5c
8 changed files with 163 additions and 11 deletions

View File

@@ -3,23 +3,25 @@ package imagerepo
import "github.com/KubeOperator/kubepi/pkg/util/imagerepo/repos"
type RepoClient interface {
Auth() error
//Auth() error
ListRepos() ([]string, error)
ListImages(repository string) (images []string, err error)
}
func NewClient(config Config) RepoClient {
switch config.Type {
case "Nexus":
return repos.NewNexusClient(config.EndPoint, config.Credential.Username, config.Credential.Password, config.DownloadUrl)
return repos.NewNexusClient(config.EndPoint, config.Credential.Username, config.Credential.Password)
case "Harbor":
return repos.NewHarborClient(config.EndPoint, config.Credential.Username, config.Credential.Password)
}
return nil
}
type Config struct {
Type string
EndPoint string
DownloadUrl string
//DownloadUrl string
Credential Credential
}
@@ -27,3 +29,4 @@ type Credential struct {
Username string
Password string
}