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

Use crictl to pull sandbox image #1605

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 23 additions & 1 deletion files/pull-sandbox-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,26 @@ if [[ "$(sudo ctr --namespace k8s.io image ls | grep $sandbox_image)" != "" ]];
exit 0
fi

/etc/eks/containerd/pull-image.sh "${sandbox_image}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to modify the pull-image.sh script itself to use crictl instead of ctr?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use ctr content fetch in that script because it skips image unpacking (an important optimization for the image caching feature's disk usage).

MAX_RETRIES=3

function retry() {
local rc=0
for attempt in $(seq 0 $MAX_RETRIES); do
rc=0
[[ $attempt -gt 0 ]] && echo "Attempt $attempt of $MAX_RETRIES" 1>&2
"$@"
rc=$?
[[ $rc -eq 0 ]] && break
[[ $attempt -eq $MAX_RETRIES ]] && exit $rc
local jitter=$((1 + RANDOM % 10))
local sleep_sec="$(($((5 << $((1 + $attempt)))) + $jitter))"
sleep $sleep_sec
done
}

ecr_password=$(retry aws ecr get-login-password)
if [[ -z ${ecr_password} ]]; then
echo >&2 "Unable to retrieve the ECR password."
exit 1
fi
retry sudo crictl pull --creds "AWS:${ecr_password}" "${sandbox_image}"
3 changes: 3 additions & 0 deletions scripts/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ sudo yum versionlock runc-*
sudo yum install -y containerd-${CONTAINERD_VERSION}
sudo yum versionlock containerd-*

# install cri-tools for crictl, needed to interact with containerd's CRI server
sudo yum install -y cri-tools

sudo mkdir -p /etc/eks/containerd
if [ -f "/etc/eks/containerd/containerd-config.toml" ]; then
## this means we are building a gpu ami and have already placed a containerd configuration file in /etc/eks
Expand Down
Loading