From 8d4767528462c2320af677cd11c62db80a59b87b Mon Sep 17 00:00:00 2001 From: Carter McKinnon Date: Tue, 3 Sep 2024 18:37:14 -0700 Subject: [PATCH] templates(al2): use ecr-credential-provider for public.ecr.aws in 1.27+ --- templates/al2/provisioners/install-worker.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/al2/provisioners/install-worker.sh b/templates/al2/provisioners/install-worker.sh index bb0d9449c..7da327498 100644 --- a/templates/al2/provisioners/install-worker.sh +++ b/templates/al2/provisioners/install-worker.sh @@ -379,6 +379,11 @@ fi sudo chmod +x $ECR_CREDENTIAL_PROVIDER_BINARY sudo mkdir -p /etc/eks/image-credential-provider sudo mv $ECR_CREDENTIAL_PROVIDER_BINARY /etc/eks/image-credential-provider/ +# ecr-credential-provider has support for public.ecr.aws in 1.27+ +if vercmp "${KUBERNETES_VERSION}" gteq "1.27.0"; then + ECR_CRED_PROVIDER_CONFIG_WITH_PUBLIC=$(cat $WORKING_DIR/ecr-credential-provider-config.json | jq '.providers[0].matchImages += ["public.ecr.aws"]') + echo "${ECR_CRED_PROVIDER_CONFIG_WITH_PUBLIC}" > $WORKING_DIR/ecr-credential-provider-config.json +fi sudo mv $WORKING_DIR/ecr-credential-provider-config.json /etc/eks/image-credential-provider/config.json ################################################################################