Add aws China regions ECR support, both of cn-north-1 and cn-northwest-1 endpoints.

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming Zhang 2020-08-27 19:14:31 +08:00 committed by Ziming
parent a651eb0949
commit bda66e9e1f
4 changed files with 47 additions and 0 deletions

View File

@ -198,6 +198,14 @@ describe("CreateEditEndpointComponent (inline template)", () => {
{
"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"
}
]
},

View File

@ -185,7 +185,16 @@ describe("EndpointComponent (inline template)", () => {
{
"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"
}
]
},
"credential_pattern": null

View File

@ -189,6 +189,14 @@ func getAdapterInfo() *model.AdapterPattern {
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",
},
},
},
}

View File

@ -49,6 +49,28 @@ func TestAdapter_NewAdapter(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, adapter)
adapter, err = newAdapter(&model.Registry{
Type: model.RegistryTypeAwsEcr,
Credential: &model.Credential{
AccessKey: "xxx",
AccessSecret: "ppp",
},
URL: "https://api.ecr.test-china-region.amazonaws.com.cn",
})
assert.Nil(t, err)
assert.NotNil(t, adapter)
adapter, err = newAdapter(&model.Registry{
Type: model.RegistryTypeAwsEcr,
Credential: &model.Credential{
AccessKey: "xxx",
AccessSecret: "ppp",
},
URL: "https://123456.dkr.ecr.test-china-region.amazonaws.com.cn",
})
assert.Nil(t, err)
assert.NotNil(t, adapter)
adapter, err = newAdapter(&model.Registry{
Type: model.RegistryTypeAwsEcr,
Credential: &model.Credential{