Skip to content

Commit

Permalink
tests/e2e: handle containerd <= 1.6
Browse files Browse the repository at this point in the history
With the new requirement of containerd 1.7+, the operator.sh was adapted
to enable the operator to install containerd in case the system's
installed version is less than or equal to 1.6.

Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm committed Oct 30, 2023
1 parent 34ef4d4 commit 4c2a81f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/e2e/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ build_pre_install_img() {
popd >/dev/null
}

# CoCo 0.8.0 onward requires containerd 1.7+ and the operator will rely on the
# system's installed version by default. Optionally, switching the
# INSTALL_OFFICIAL_CONTAINERD environment variable to "true" tells the pre-reqs
# script to install an official containerd that matches the 1.7+ requirement.
# Because some of our CI systems are running on Ubuntu 20.04 and CentOS Stream8,
# and those OSes comes with containerd 1.6, this function is used to flip the
# INSTALL_OFFICIAL_CONTAINERD's value to true, i.e., tells the operator to
# installation to deploy containerd too.
#
handle_older_containerd() {
command -v containerd >/dev/null || return
local version
version=$(containerd -v | awk '{ print $3 }')
echo "system's containerd version: $version"
if [[ "$version" =~ ^1.6 || "$version" =~ ^1.5 ]]; then
echo "Old system's containerd ($version). Configuring the operator to install a newer one"
pushd "$project_dir" >/dev/null
for kfile in $(find config/ -name "kustomization.yaml" \
-exec grep -l INSTALL_OFFICIAL_CONTAINERD {} \;);do
sed -i '/INSTALL_OFFICIAL_CONTAINERD/!b;n;s/false/true/;' $kfile
echo "DEBUG: print changed kustomization files"
git diff config
done
popd >/dev/null
fi
}

# Install the operator.
#
install_operator() {
Expand All @@ -66,6 +93,8 @@ install_operator() {
kubectl label node "$(hostname)" "$label="
fi

handle_older_containerd

pushd "$project_dir" >/dev/null
# We should use a locally built image for operator.
sed -i "s~\(.*newName: \).*~\1${IMG}~g" config/manager/kustomization.yaml
Expand Down

0 comments on commit 4c2a81f

Please sign in to comment.