Merge pull request #14676 from bitsf/update_adapter_region

update aliyun and aws region
This commit is contained in:
Steven Zou 2021-04-19 11:17:07 +08:00 committed by GitHub
commit cae82dc3d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 100 deletions

View File

@ -145,31 +145,42 @@ func (a *adapter) Info() (info *model.RegistryInfo, err error) {
}
func getAdapterInfo() *model.AdapterPattern {
var endpoints []*model.Endpoint
// https://help.aliyun.com/document_detail/40654.html?spm=a2c4g.11186623.2.7.58683ae5Q4lo1o
for _, e := range []string{
"cn-qingdao",
"cn-beijing",
"cn-zhangjiakou",
"cn-huhehaote",
"cn-wulanchabu",
"cn-hangzhou",
"cn-shanghai",
"cn-shenzhen",
"cn-heyuan",
"cn-guangzhou",
"cn-chengdu",
"cn-hongkong",
"ap-southeast-1",
"ap-southeast-2",
"ap-southeast-3",
"ap-southeast-5",
"ap-south-1",
"ap-northeast-1",
"us-west-1",
"us-east-1",
"eu-central-1",
"eu-west-1",
"me-east-1",
} {
endpoints = append(endpoints, &model.Endpoint{
Key: e,
Value: fmt.Sprintf("https://registry.%s.aliyuncs.com", e),
})
}
info := &model.AdapterPattern{
EndpointPattern: &model.EndpointPattern{
EndpointType: model.EndpointPatternTypeList,
Endpoints: []*model.Endpoint{
{Key: "cn-hangzhou", Value: "https://registry.cn-hangzhou.aliyuncs.com"},
{Key: "cn-shanghai", Value: "https://registry.cn-shanghai.aliyuncs.com"},
{Key: "cn-qingdao", Value: "https://registry.cn-qingdao.aliyuncs.com"},
{Key: "cn-beijing", Value: "https://registry.cn-beijing.aliyuncs.com"},
{Key: "cn-zhangjiakou", Value: "https://registry.cn-zhangjiakou.aliyuncs.com"},
{Key: "cn-huhehaote", Value: "https://registry.cn-huhehaote.aliyuncs.com"},
{Key: "cn-shenzhen", Value: "https://registry.cn-shenzhen.aliyuncs.com"},
{Key: "cn-chengdu", Value: "https://registry.cn-chengdu.aliyuncs.com"},
{Key: "cn-hongkong", Value: "https://registry.cn-hongkong.aliyuncs.com"},
{Key: "ap-southeast-1", Value: "https://registry.ap-southeast-1.aliyuncs.com"},
{Key: "ap-southeast-2", Value: "https://registry.ap-southeast-2.aliyuncs.com"},
{Key: "ap-southeast-3", Value: "https://registry.ap-southeast-3.aliyuncs.com"},
{Key: "ap-southeast-5", Value: "https://registry.ap-southeast-5.aliyuncs.com"},
{Key: "ap-northeast-1", Value: "https://registry.ap-northeast-1.aliyuncs.com"},
{Key: "ap-south-1", Value: "https://registry.ap-south-1.aliyuncs.com"},
{Key: "eu-central-1", Value: "https://registry.eu-central-1.aliyuncs.com"},
{Key: "eu-west-1", Value: "https://registry.eu-west-1.aliyuncs.com"},
{Key: "us-west-1", Value: "https://registry.us-west-1.aliyuncs.com"},
{Key: "us-east-1", Value: "https://registry.us-east-1.aliyuncs.com"},
{Key: "me-east-1", Value: "https://registry.me-east-1.aliyuncs.com"},
},
Endpoints: endpoints,
},
}
return info

View File

@ -16,6 +16,7 @@ package awsecr
import (
"errors"
"fmt"
"regexp"
"github.com/aws/aws-sdk-go/aws/awserr"
@ -116,87 +117,42 @@ func (*adapter) Info() (info *model.RegistryInfo, err error) {
}
func getAdapterInfo() *model.AdapterPattern {
var endpoints []*model.Endpoint
// https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints
for _, e := range []string{
"us-east-2",
"us-east-1",
"us-west-1",
"us-west-2",
"af-south-1",
"ap-east-1",
"ap-south-1",
"ap-northeast-3",
"ap-northeast-2",
"ap-southeast-1",
"ap-southeast-2",
"ap-northeast-1",
"ca-central-1",
"cn-north-1",
"cn-northwest-1",
"eu-central-1",
"eu-west-1",
"eu-west-2",
"eu-south-1",
"eu-west-3",
"eu-north-1",
"me-south-1",
"sa-east-1",
} {
endpoints = append(endpoints, &model.Endpoint{
Key: e,
Value: fmt.Sprintf("https://%s.amazonaws.com", e),
})
}
info := &model.AdapterPattern{
EndpointPattern: &model.EndpointPattern{
EndpointType: model.EndpointPatternTypeList,
Endpoints: []*model.Endpoint{
{
Key: "ap-northeast-1",
Value: "https://api.ecr.ap-northeast-1.amazonaws.com",
},
{
Key: "us-east-1",
Value: "https://api.ecr.us-east-1.amazonaws.com",
},
{
Key: "us-east-2",
Value: "https://api.ecr.us-east-2.amazonaws.com",
},
{
Key: "us-west-1",
Value: "https://api.ecr.us-west-1.amazonaws.com",
},
{
Key: "us-west-2",
Value: "https://api.ecr.us-west-2.amazonaws.com",
},
{
Key: "ap-east-1",
Value: "https://api.ecr.ap-east-1.amazonaws.com",
},
{
Key: "ap-south-1",
Value: "https://api.ecr.ap-south-1.amazonaws.com",
},
{
Key: "ap-northeast-2",
Value: "https://api.ecr.ap-northeast-2.amazonaws.com",
},
{
Key: "ap-southeast-1",
Value: "https://api.ecr.ap-southeast-1.amazonaws.com",
},
{
Key: "ap-southeast-2",
Value: "https://api.ecr.ap-southeast-2.amazonaws.com",
},
{
Key: "ca-central-1",
Value: "https://api.ecr.ca-central-1.amazonaws.com",
},
{
Key: "eu-central-1",
Value: "https://api.ecr.eu-central-1.amazonaws.com",
},
{
Key: "eu-west-1",
Value: "https://api.ecr.eu-west-1.amazonaws.com",
},
{
Key: "eu-west-2",
Value: "https://api.ecr.eu-west-2.amazonaws.com",
},
{
Key: "eu-west-3",
Value: "https://api.ecr.eu-west-3.amazonaws.com",
},
{
Key: "eu-north-1",
Value: "https://api.ecr.eu-north-1.amazonaws.com",
},
{
Key: "sa-east-1",
Value: "https://api.ecr.sa-east-1.amazonaws.com",
},
{
Key: "cn-north-1",
Value: "https://api.ecr.cn-north-1.amazonaws.com.cn",
},
{
Key: "cn-northwest-1",
Value: "https://api.ecr.cn-northwest-1.amazonaws.com.cn",
},
},
Endpoints: endpoints,
},
}
return info