Try using preloaded containerd if no version is specified.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2018-04-19 01:30:13 -07:00 committed by Derek McGowan
parent c67a38b0b5
commit 48457a254e
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB

View File

@ -92,10 +92,6 @@ if [ "${CONTAINERD_TEST:-"false"}" != "true" ]; then
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-release"}
# CONTAINERD_VERSION is the cri-containerd version to use.
version=${CONTAINERD_VERSION:-""}
if [ -z "${version}" ]; then
echo "CONTAINERD_VERSION is not set."
exit 1
fi
else
deploy_path=${CONTAINERD_DEPLOY_PATH:-"cri-containerd-staging"}
@ -118,9 +114,20 @@ TARBALL_GCS_NAME="${pkg_prefix}-${version}.linux-amd64.tar.gz"
TARBALL_GCS_PATH="https://storage.googleapis.com/${deploy_path}/${TARBALL_GCS_NAME}"
# TARBALL is the name of the tarball after being downloaded.
TARBALL="cri-containerd.tar.gz"
# CONTAINERD_TAR_SHA1 is the sha1sum of containerd tarball.
if is_preloaded "${TARBALL_GCS_NAME}" "${CONTAINERD_TAR_SHA1:-""}"; then
tar_sha1="${CONTAINERD_TAR_SHA1:-""}"
if [ -z "${version}" ]; then
# Try using preloaded containerd if version is not specified.
tarball_gcs_pattern="${pkg_prefix}-.*.linux-amd64.tar.gz"
if is_preloaded "${tarball_gcs_pattern}" "${tar_sha1}"; then
echo "CONTAINERD_VERSION is not set, use preloaded containerd"
else
echo "CONTAINERD_VERSION is not set, and containerd is not preloaded"
exit 1
fi
else
if is_preloaded "${TARBALL_GCS_NAME}" "${tar_sha1}"; then
echo "${TARBALL_GCS_NAME} is preloaded"
else
# Download and untar the release tar ball.
@ -128,6 +135,7 @@ else
tar xvf "${TARBALL}"
rm -f "${TARBALL}"
fi
fi
# Configure containerd.
# Copy crictl config.