Skip to content

Commit

Permalink
Specify region for local zones during sandbox image ECR auth (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndbaker1 authored Feb 5, 2024
1 parent 7d6230e commit 107df3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion files/pull-sandbox-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit 107df3f

Please sign in to comment.