Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Tag cached image with the ECR URI for the given target region #1442

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ if [[ "$CACHE_CONTAINER_IMAGES" == "true" ]] && ! [[ ${ISOLATED_REGIONS} =~ $BIN
${VPC_CNI_IMGS[@]+"${VPC_CNI_IMGS[@]}"}
)
PULLED_IMGS=()
REGIONS=$(aws ec2 describe-regions --all-regions --output text --query 'Regions[].[RegionName]')

for img in "${CACHE_IMGS[@]}"; do
## only kube-proxy-minimal is vended for K8s 1.24+
Expand All @@ -465,9 +466,10 @@ if [[ "$CACHE_CONTAINER_IMAGES" == "true" ]] && ! [[ ${ISOLATED_REGIONS} =~ $BIN
done

#### Tag the pulled down image for all other regions in the partition
for region in $(aws ec2 describe-regions --all-regions | jq -r '.Regions[] .RegionName'); do
for REGION in "${REGIONS[@]}"; do
for img in "${PULLED_IMGS[@]}"; do
regional_img="${img/$BINARY_BUCKET_REGION/$region}"
region_uri=$(/etc/eks/get-ecr-uri.sh "${region}" "${AWS_DOMAIN}")
regional_img="${img/$ECR_URI/$region_uri}"
sudo ctr -n k8s.io image tag "${img}" "${regional_img}" || :
## Tag ECR fips endpoint for supported regions
if [[ "${region}" =~ (us-east-1|us-east-2|us-west-1|us-west-2|us-gov-east-1|us-gov-east-2) ]]; then
Expand Down