Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

chore: install specific containerd version, make version configurable #516

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion packer/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if [[ ${FEATURE_FLAGS} == *"docker-engine"* ]]; then
DOCKER_ENGINE_REPO="https://apt.dockerproject.org/repo"
installDockerEngine
installGPUDrivers
installContainerd
Copy link
Member Author

Choose a reason for hiding this comment

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

Just to be conservative/iterative, let's keep the installContainerd invocation in the VHD for non-moby scenario.

(See below that it used to be here.)

I don't think we strictly need to be doing this installation, but the safest way is to make that change distinctly.

The reason we're removing it from moby is that the moby installation implementation currently installs containerd stuffs itself.

else
MOBY_VERSION="3.0.4"
installMoby
Expand All @@ -28,6 +29,7 @@ installClearContainersRuntime

VNET_CNI_VERSIONS="1.0.16 1.0.17"
CNI_PLUGIN_VERSIONS="0.7.1"
CONTAINERD_VERSIONS="1.1.5"

for VNET_CNI_VERSION in $VNET_CNI_VERSIONS; do
VNET_CNI_PLUGINS_URL="https://acs-mirror.azureedge.net/cni/azure-vnet-cni-linux-amd64-v${VNET_CNI_VERSION}.tgz"
Expand All @@ -39,7 +41,10 @@ for CNI_PLUGIN_VERSION in $CNI_PLUGIN_VERSIONS; do
downloadCNI
done

installContainerd
for CONTAINERD_VERSION in $CONTAINERD_VERSIONS; do
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of actually doing the install, we're just downloading the artifacts in the VHD.

CONTAINERD_DOWNLOAD_URL="${CONTAINERD_DOWNLOAD_URL_BASE}cri-containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz"
downloadContainerd
done

installImg

Expand Down
4 changes: 3 additions & 1 deletion parts/k8s/kubernetescustomscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ fi

installContainerRuntime
installNetworkPlugin
installContainerd
if [[ "$CONTAINER_RUNTIME" == "clear-containers" ]] || [[ "$CONTAINER_RUNTIME" == "kata-containers" ]] || [[ "$CONTAINER_RUNTIME" == "containerd" ]]; then
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 only actually install the containerd artifacts for required scenarios at provisioning time.

installContainerd
fi
if [[ "${GPU_NODE}" = true ]]; then
if $FULL_INSTALL_REQUIRED; then
installGPUDrivers
Expand Down
18 changes: 12 additions & 6 deletions parts/k8s/kubernetesinstalls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CNI_DOWNLOADS_DIR="/opt/cni/downloads"
CONTAINERD_DOWNLOADS_DIR="/opt/containerd/downloads"
CRI_CONTAINERD_VERSION="1.1.5"
CONTAINERD_DOWNLOAD_URL="${CONTAINERD_DOWNLOAD_URL_BASE}cri-containerd-${CRI_CONTAINERD_VERSION}.linux-amd64.tar.gz"
CONTAINERD_TGZ_TMP=$(echo ${CONTAINERD_DOWNLOAD_URL} | cut -d "/" -f 5)

removeEtcd() {
rm -rf /usr/bin/etcd
Expand Down Expand Up @@ -190,6 +189,7 @@ downloadAzureCNI() {

downloadContainerd() {
mkdir -p $CONTAINERD_DOWNLOADS_DIR
CONTAINERD_TGZ_TMP=$(echo ${CONTAINERD_DOWNLOAD_URL} | cut -d "/" -f 5)
retrycmd_get_tarball 120 5 "$CONTAINERD_DOWNLOADS_DIR/${CONTAINERD_TGZ_TMP}" ${CONTAINERD_DOWNLOAD_URL} || exit $ERR_CONTAINERD_DOWNLOAD_TIMEOUT
}

Expand Down Expand Up @@ -217,11 +217,17 @@ installAzureCNI() {
}

installContainerd() {
containerd --version
if [ $? -eq 0 ]; then
echo "containerd is already installed, skipping download"
else
downloadContainerd
CONTAINERD_TGZ_TMP=$(echo ${CONTAINERD_DOWNLOAD_URL} | cut -d "/" -f 5)
CURRENT_VERSION=$(containerd -version | cut -d " " -f 3 | sed 's|v||')
if [[ "$CURRENT_VERSION" == "${CRI_CONTAINERD_VERSION}" ]]; then
echo "containerd is already installed, skipping install"
else
rm -Rf /usr/bin/containerd
rm -Rf /var/lib/docker/containerd
rm -Rf /run/docker/containerd
if [[ ! -f "$CONTAINERD_DOWNLOADS_DIR/${CONTAINERD_TGZ_TMP}" ]]; then
downloadContainerd
fi
tar -xzf "$CONTAINERD_DOWNLOADS_DIR/$CONTAINERD_TGZ_TMP" -C /
rm -Rf $CONTAINERD_DOWNLOADS_DIR &
sed -i '/\[Service\]/a ExecStartPost=\/sbin\/iptables -P FORWARD ACCEPT' /etc/systemd/system/containerd.service
Expand Down
Loading