From 667600536b93b089c805195bf00aa275b6bb76c4 Mon Sep 17 00:00:00 2001 From: Victor Pineda Gonzalez Date: Tue, 22 Nov 2022 14:48:10 -0800 Subject: [PATCH] Skip sandbox image pull if already present (#1090) --- files/pull-sandbox-image.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/files/pull-sandbox-image.sh b/files/pull-sandbox-image.sh index 523e7ed4c..e1c1a6eb8 100644 --- a/files/pull-sandbox-image.sh +++ b/files/pull-sandbox-image.sh @@ -2,4 +2,10 @@ set -euo pipefail sandbox_image="$(awk -F'[ ="]+' '$1 == "sandbox_image" { print $2 }' /etc/containerd/config.toml)" + +### Short-circuit fetching sandbox image if its already present +if [[ "$(sudo ctr --namespace k8s.io image ls | grep $sandbox_image)" != "" ]]; then + exit 0 +fi + /etc/eks/containerd/pull-image.sh "${sandbox_image}"