kata-deploy-cc: Simplify the script

As containerd is the only supported container engine, let's simplify the
script and, at the same time, make it clear that other container engines
are not supported yet.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2022-09-05 14:17:44 +02:00
parent 1f610ea5cc
commit f684d00d50

View File

@ -204,11 +204,7 @@ function remove_artifacts() {
function cleanup_cri_runtime() {
cleanup_different_shims_base
case $1 in
containerd | k3s | k3s-agent | rke2-agent | rke2-server)
cleanup_containerd
;;
esac
}
@ -223,9 +219,7 @@ function reset_runtime() {
kubectl label node "$NODE_NAME" katacontainers.io/kata-runtime-
systemctl daemon-reload
systemctl restart "$1"
if [ "$1" == "containerd" ]; then
systemctl restart kubelet
fi
}
function main() {
@ -236,22 +230,14 @@ function main() {
fi
runtime=$(get_container_runtime)
if [ "$runtime" == "k3s" ] || [ "$runtime" == "k3s-agent" ] || [ "$runtime" == "rke2-agent" ] || [ "$runtime" == "rke2-server" ]; then
containerd_conf_tmpl_file="${containerd_conf_file}.tmpl"
if [ ! -f "$containerd_conf_tmpl_file" ]; then
cp "$containerd_conf_file" "$containerd_conf_tmpl_file"
if [ "$runtime" != "containerd" ]; then
die "$runtime is not supported for now"
fi
containerd_conf_file="${containerd_conf_tmpl_file}"
containerd_conf_file_backup="${containerd_conf_file}.bak"
elif [ "$runtime" == "containerd" ]; then
# runtime == containerd
if [ ! -f "$containerd_conf_file" ] && [ -d $(dirname "$containerd_conf_file") ] && \
[ -x $(command -v containerd) ]; then
containerd config default > "$containerd_conf_file"
fi
fi
action=${1:-}
if [ -z "$action" ]; then
@ -259,9 +245,6 @@ function main() {
die "invalid arguments"
fi
# only install / remove / update if we are dealing with containerd
if [[ "$runtime" =~ ^(containerd|k3s|k3s-agent|rke2-agent|rke2-server)$ ]]; then
case "$action" in
install)
install_artifacts
@ -281,7 +264,6 @@ function main() {
print_usage
;;
esac
fi
#It is assumed this script will be called as a daemonset. As a result, do
# not return, otherwise the daemon will restart and rexecute the script