kata-deploy: Stop linking binaries to /usr/local/bin

Neither CRI-O nor containerd requires that, and removing such symlinks
makes everything less intrusive from our side.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2024-08-17 19:22:38 +02:00
parent c2393dc467
commit d03b72f19b
No known key found for this signature in database
GPG Key ID: EE926C2BDACC177B
3 changed files with 4 additions and 95 deletions

View File

@ -65,8 +65,6 @@ spec:
mountPath: /etc/containerd/
- name: kata-artifacts
mountPath: /opt/kata/
- name: local-bin
mountPath: /usr/local/bin/
- name: host
mountPath: /host/
volumes:
@ -80,9 +78,6 @@ spec:
hostPath:
path: /opt/kata/
type: DirectoryOrCreate
- name: local-bin
hostPath:
path: /usr/local/bin/
- name: host
hostPath:
path: /

View File

@ -59,8 +59,6 @@ spec:
mountPath: /etc/containerd/
- name: kata-artifacts
mountPath: /opt/kata/
- name: local-bin
mountPath: /usr/local/bin/
- name: host
mountPath: /host/
volumes:
@ -74,9 +72,6 @@ spec:
hostPath:
path: /opt/kata/
type: DirectoryOrCreate
- name: local-bin
hostPath:
path: /usr/local/bin/
- name: host
hostPath:
path: /

View File

@ -323,8 +323,6 @@ function wait_till_node_is_ready() {
}
function configure_cri_runtime() {
configure_different_shims_base
case $1 in
crio)
configure_crio
@ -344,87 +342,6 @@ function configure_cri_runtime() {
wait_till_node_is_ready
}
function backup_shim() {
local shim_file="$1"
local shim_backup="${shim_file}.bak"
if [ -f "${shim_file}" ]; then
echo "warning: ${shim_file} already exists" >&2
if [ ! -f "${shim_backup}" ]; then
mv "${shim_file}" "${shim_backup}"
else
rm -f "${shim_file}"
fi
fi
}
function configure_different_shims_base() {
# Currently containerd has an assumption on the location of the shimv2 implementation
# This forces kata-deploy to create files in a well-defined location that's part of
# the PATH, pointing to the containerd-shim-kata-v2 binary in /opt/kata/bin
# Issues:
# https://github.com/containerd/containerd/issues/3073
# https://github.com/containerd/containerd/issues/5006
local default_shim_file="/usr/local/bin/containerd-shim-kata-v2"
mkdir -p /usr/local/bin
for shim in "${shims[@]}"; do
local shim_binary="containerd-shim-kata-${shim}-v2"
local shim_file="/usr/local/bin/${shim_binary}"
backup_shim "${shim_file}"
# Map the runtime shim name to the appropriate
# containerd-shim-kata-v2 binary
case "$shim" in
cloud-hypervisor | dragonball | qemu-runtime-rs)
ln -sf /opt/kata/runtime-rs/bin/containerd-shim-kata-v2 "${shim_file}" ;;
*)
ln -sf /opt/kata/bin/containerd-shim-kata-v2 "${shim_file}" ;;
esac
chmod +x "$shim_file"
if [ "${shim}" == "${default_shim}" ]; then
backup_shim "${default_shim_file}"
echo "Creating the default shim-v2 binary"
ln -sf "${shim_file}" "${default_shim_file}"
fi
done
}
function restore_shim() {
local shim_file="$1"
local shim_backup="${shim_file}.bak"
if [ -f "${shim_backup}" ]; then
mv "$shim_backup" "$shim_file"
fi
}
function cleanup_different_shims_base() {
local default_shim_file="/usr/local/bin/containerd-shim-kata-v2"
for shim in "${shims[@]}"; do
local shim_binary="containerd-shim-kata-${shim}-v2"
local shim_file="/usr/local/bin/${shim_binary}"
rm -f "${shim_file}"
restore_shim "${shim_file}"
done
rm -f "${default_shim_file}"
restore_shim "${default_shim_file}"
if [[ "${CREATE_RUNTIMECLASSES}" == "true" ]]; then
delete_runtimeclasses
fi
}
function configure_crio_runtime() {
local shim="${1}"
local runtime="kata-${shim}"
@ -564,11 +481,13 @@ function configure_containerd() {
function remove_artifacts() {
echo "deleting kata artifacts"
rm -rf /opt/kata/*
if [[ "${CREATE_RUNTIMECLASSES}" == "true" ]]; then
delete_runtimeclasses
fi
}
function cleanup_cri_runtime() {
cleanup_different_shims_base
case $1 in
crio)
cleanup_crio