Merge pull request #112901 from vinaykul/ubuntu-kube-up-fix

Fix 'ctr not found' error with gce kube-up for Ubuntu OS deployments
This commit is contained in:
Kubernetes Prow Robot 2022-10-17 18:05:18 -07:00 committed by GitHub
commit 51185b77a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -585,12 +585,29 @@ providers:
EOF
}
function ensure-container-runtime {
function ensure-containerd-runtime {
# Install containerd/runc if requested
if [[ -n "${UBUNTU_INSTALL_CONTAINERD_VERSION:-}" || -n "${UBUNTU_INSTALL_RUNC_VERSION:-}" ]]; then
log-wrap "InstallContainerdUbuntu" install-containerd-ubuntu
fi
# Fall back to installing distro specific containerd, if not found
if ! command -v containerd >/dev/null 2>&1; then
local linuxrelease="cos"
if [[ -n "$(command -v lsb_release)" ]]; then
linuxrelease=$(lsb_release -si)
fi
case "${linuxrelease}" in
Ubuntu)
log-wrap "InstallContainerdUbuntu" install-containerd-ubuntu
;;
*)
echo "Installing containerd for linux release ${linuxrelease} not supported" >&2
exit 2
;;
esac
fi
# when custom containerd version is installed sourcing containerd_env.sh will add all tools like ctr to the PATH
if [[ -e "/etc/profile.d/containerd_env.sh" ]]; then
log-wrap 'SourceContainerdEnv' source "/etc/profile.d/containerd_env.sh"
@ -614,6 +631,19 @@ function ensure-container-runtime {
runc --version
}
function ensure-container-runtime {
case "${CONTAINER_RUNTIME_NAME:-containerd}" in
containerd)
ensure-containerd-runtime
;;
#TODO: Add crio support
*)
echo "Unsupported container runtime (${CONTAINER_RUNTIME_NAME})." >&2
exit 2
;;
esac
}
# Downloads kubernetes binaries and kube-system manifest tarball, unpacks them,
# and places them into suitable directories. Files are placed in /home/kubernetes.
function install-kube-binary-config {