From 107df3fb9264e47cfd1e269ac5cc69ab4c4a8e3c Mon Sep 17 00:00:00 2001 From: Nick Baker Date: Mon, 5 Feb 2024 13:54:52 -0800 Subject: [PATCH] Specify region for local zones during sandbox image ECR auth (#1626) --- files/pull-sandbox-image.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/pull-sandbox-image.sh b/files/pull-sandbox-image.sh index b123b50aa..02b651a9e 100644 --- a/files/pull-sandbox-image.sh +++ b/files/pull-sandbox-image.sh @@ -8,6 +8,10 @@ if [[ "$(sudo ctr --namespace k8s.io image ls | grep $sandbox_image)" != "" ]]; exit 0 fi +# use the region that the sandbox image comes from for the ecr authentication, +# also mitigating the localzone isse: https://github.com/aws/aws-cli/issues/7043 +region=$(echo "${sandbox_image}" | cut -f4 -d ".") + MAX_RETRIES=3 function retry() { @@ -25,7 +29,7 @@ function retry() { done } -ecr_password=$(retry aws ecr get-login-password) +ecr_password=$(retry aws ecr get-login-password --region $region) if [[ -z ${ecr_password} ]]; then echo >&2 "Unable to retrieve the ECR password." exit 1