Skip to content

Commit d667606

Browse files
committed
feat(host-ctr): add eusc-de-east-1 ecr prefix mapping
1 parent f2759f7 commit d667606

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sources/host-ctr/cmd/host-ctr/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242

4343
// ECR hostname pattern also used in the ecr-credential-provider:
4444
// https://github.com/kubernetes/cloud-provider-aws/blob/212135d0d7b448cd34e2e11e5e81f59e3e6c2d7a/cmd/ecr-credential-provider/main.go#L45
45-
var ecrRegex = regexp.MustCompile(`^(\d{12})\.dkr[\.\-]ecr(-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.(amazonaws\.com(?:\.cn)?|on\.(?:aws|amazonwebservices\.com\.cn)|sc2s\.sgov\.gov|c2s\.ic\.gov|cloud\.adc-e\.uk|csp\.hci\.ic\.gov).*$`)
45+
var ecrRegex = regexp.MustCompile(`^(\d{12})\.dkr[\.\-]ecr(-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.(amazonaws(\.com(?:\.cn)?|\.eu)|on\.(?:aws|amazonwebservices\.com\.cn)|sc2s\.sgov\.gov|c2s\.ic\.gov|cloud\.adc-e\.uk|csp\.hci\.ic\.gov).*$`)
4646

4747
// A set of currently supported ECR regions which are not yet present in the golang SDK
4848
var ecrRefPrefixMapping = map[string]string{
@@ -52,6 +52,7 @@ var ecrRefPrefixMapping = map[string]string{
5252
"ap-southeast-6": "ecr.aws/arn:aws:ecr:ap-southeast-6:",
5353
"us-northeast-1": "ecr.aws/arn:aws:ecr:us-northeast-1:",
5454
"eu-isoe-west-1": "ecr.aws/arn:aws-iso-e:ecr:eu-isoe-west-1:",
55+
"eusc-de-east-1": "ecr.aws/arn:aws-eusc:ecr:eusc-de-east-1:",
5556
"us-iso-east-1": "ecr.aws/arn:aws-iso:ecr:us-iso-east-1:",
5657
"us-iso-west-1": "ecr.aws/arn:aws-iso:ecr:us-iso-west-1:",
5758
"us-isob-east-1": "ecr.aws/arn:aws-iso-b:ecr:us-isob-east-1:",

sources/host-ctr/cmd/host-ctr/main_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,17 @@ func TestParseImageURIAsECR(t *testing.T) {
202202
Fips: false,
203203
},
204204
},
205+
{
206+
"Parse special region",
207+
"777777777777.dkr.ecr.eusc-de-east-1.amazonaws.eu/my_image:latest",
208+
false,
209+
&parsedECR{
210+
Account: "777777777777",
211+
Region: "eusc-de-east-1",
212+
RepoPath: "my_image:latest",
213+
Fips: false,
214+
},
215+
},
205216
{
206217
"Parse special region",
207218
"777777777777.dkr.ecr.us-iso-east-1.c2s.ic.gov/my_image:latest",

0 commit comments

Comments
 (0)