Skip to content

Commit 4c8207d

Browse files
authored
Merge pull request kubernetes#92314 from dims/set-better-default-for-loading-images-2
Set better default commands for loading images - take 2
2 parents c6011f2 + 60bd17a commit 4c8207d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cluster/gce/gci/configure.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,18 @@ function try-load-docker-image {
376376
set +e
377377
local -r max_attempts=5
378378
local -i attempt_num=1
379-
until timeout 30 ${LOAD_IMAGE_COMMAND:-docker load -i} "${img}"; do
379+
380+
if [[ "${CONTAINER_RUNTIME_NAME:-}" == "docker" ]]; then
381+
load_image_command=${LOAD_IMAGE_COMMAND:-docker load -i}
382+
elif [[ "${CONTAINER_RUNTIME_NAME:-}" == "containerd" ]]; then
383+
load_image_command=${LOAD_IMAGE_COMMAND:-ctr -n=k8s.io images import}
384+
else
385+
load_image_command="${LOAD_IMAGE_COMMAND:-}"
386+
fi
387+
388+
until timeout 30 ${load_image_command} "${img}"; do
380389
if [[ "${attempt_num}" == "${max_attempts}" ]]; then
381-
echo "Fail to load docker image file ${img} after ${max_attempts} retries. Exit!!"
390+
echo "Fail to load docker image file ${img} using ${load_image_command} after ${max_attempts} retries. Exit!!"
382391
exit 1
383392
else
384393
attempt_num=$((attempt_num+1))

0 commit comments

Comments
 (0)