Support pre-downloading/uploading docker images

This commit allows pre-downloading docker images in devstack
and make the list of images configurable.
As a result, each zuul job can specify the list of images that
needs to be pre-downloaded and uploaded to glance.

Change-Id: I43e5f3aecf709bdbc55dfbae7cc871058f7b7c8d
This commit is contained in:
Hongbin Lu 2018-11-26 03:21:16 +00:00
parent 43552ddcad
commit b73b7191e6
2 changed files with 11 additions and 5 deletions

View File

@ -85,6 +85,8 @@ if is_ubuntu; then
UBUNTU_RELEASE_BASE_NUM=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1` UBUNTU_RELEASE_BASE_NUM=`lsb_release -r | awk '{print $2}' | cut -d '.' -f 1`
fi fi
ZUN_DOCKER_IMAGES=${ZUN_DOCKER_IMAGES:-kubernetes/pause}
# Functions # Functions
# --------- # ---------
@ -128,11 +130,15 @@ function configure_zun {
fi fi
} }
# upload_sandbox_image() - Upload sandbox image to glance # upload_images() - Upload docker images to glance
function upload_sandbox_image { function upload_images {
echo_summary "Uploading images"
if "${ZUN_DRIVER}" == "docker" && is_service_enabled g-api; then if "${ZUN_DRIVER}" == "docker" && is_service_enabled g-api; then
sudo docker pull kubernetes/pause for image in ${ZUN_DOCKER_IMAGES//,/ }; do
sudo docker save kubernetes/pause | openstack image create kubernetes/pause --public --container-format docker --disk-format raw sudo docker pull $image
sudo docker save $image | openstack image create $image --public --container-format docker --disk-format raw
done
fi fi
} }

View File

@ -31,7 +31,7 @@ if is_service_enabled zun-api zun-compute; then
# Start the zun API and zun compute # Start the zun API and zun compute
echo_summary "Starting zun" echo_summary "Starting zun"
start_zun start_zun
upload_sandbox_image upload_images
fi fi