Skip to content

Commit

Permalink
fix: Tag cached image with the ECR URI for the target region (#1442)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored Sep 27, 2023
1 parent 5d5db2f commit be7bc10
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit be7bc10

Please sign in to comment.