From 7be77ebee54e0794ca25e10edb8008ededc83def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 22 Aug 2024 12:26:09 +0200 Subject: [PATCH] kata-deploy: helm: Stop mounting /opt/kata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's simply easier if we just use /host/opt/kata instead in our scripts, which will simplify a lot the logic of adding an INSTALLATION_PREFIX later on. Signed-off-by: Fabiano FidĂȘncio --- .../kata-deploy/templates/kata-deploy.yaml | 6 ------ .../kata-deploy/base/kata-deploy.yaml | 6 ------ .../kata-deploy/scripts/kata-deploy.sh | 18 +++++++++++------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/tools/packaging/kata-deploy/helm-chart/kata-deploy/templates/kata-deploy.yaml b/tools/packaging/kata-deploy/helm-chart/kata-deploy/templates/kata-deploy.yaml index 22b5e13d79..cd64dfbd7e 100644 --- a/tools/packaging/kata-deploy/helm-chart/kata-deploy/templates/kata-deploy.yaml +++ b/tools/packaging/kata-deploy/helm-chart/kata-deploy/templates/kata-deploy.yaml @@ -63,8 +63,6 @@ spec: mountPath: /etc/crio/ - name: containerd-conf mountPath: /etc/containerd/ - - name: kata-artifacts - mountPath: /opt/kata/ - name: host mountPath: /host/ volumes: @@ -74,10 +72,6 @@ spec: - name: containerd-conf hostPath: path: '{{- template "containerdConfPath" .Values }}' - - name: kata-artifacts - hostPath: - path: /opt/kata/ - type: DirectoryOrCreate - name: host hostPath: path: / diff --git a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml index 9bf051fa79..19b0a381db 100644 --- a/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml +++ b/tools/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml @@ -57,8 +57,6 @@ spec: mountPath: /etc/crio/ - name: containerd-conf mountPath: /etc/containerd/ - - name: kata-artifacts - mountPath: /opt/kata/ - name: host mountPath: /host/ volumes: @@ -68,10 +66,6 @@ spec: - name: containerd-conf hostPath: path: /etc/containerd/ - - name: kata-artifacts - hostPath: - path: /opt/kata/ - type: DirectoryOrCreate - name: host hostPath: path: / diff --git a/tools/packaging/kata-deploy/scripts/kata-deploy.sh b/tools/packaging/kata-deploy/scripts/kata-deploy.sh index 5e5afcd3d2..efce08c152 100755 --- a/tools/packaging/kata-deploy/scripts/kata-deploy.sh +++ b/tools/packaging/kata-deploy/scripts/kata-deploy.sh @@ -37,6 +37,7 @@ PULL_TYPE_MAPPING="${PULL_TYPE_MAPPING:-}" IFS=',' read -a pull_types <<< "$PULL_TYPE_MAPPING" dest_dir="/opt/kata" +host_install_dir="/host/${dest_dir}" # If we fail for any reason a message will be displayed die() { @@ -239,15 +240,17 @@ function get_tdx_ovmf_path_from_distro() { function install_artifacts() { echo "copying kata artifacts onto host" - cp -au /opt/kata-artifacts/opt/kata/* ${dest_dir}/ - chmod +x ${dest_dir}/bin/* - [ -d ${dest_dir}/runtime-rs/bin ] && \ - chmod +x ${dest_dir}/runtime-rs/bin/* + + mkdir -p ${host_install_dir} + cp -au /opt/kata-artifacts/opt/kata/* ${host_install_dir}/ + chmod +x ${host_install_dir}/bin/* + [ -d ${host_install_dir}/runtime-rs/bin ] && \ + chmod +x ${host_install_dir}/runtime-rs/bin/* local config_path for shim in "${shims[@]}"; do - config_path=$(get_kata_containers_config_path "${shim}") + config_path="/host/$(get_kata_containers_config_path "${shim}")" mkdir -p "$config_path" local kata_config_file="${config_path}/configuration-${shim}.toml" @@ -304,7 +307,7 @@ function install_artifacts() { # Allow Mariner to use custom configuration. if [ "${HOST_OS:-}" == "cbl-mariner" ]; then - config_path="${dest_dir}/share/defaults/kata-containers/configuration-clh.toml" + config_path="${host_install_dir}/share/defaults/kata-containers/configuration-clh.toml" clh_path="${dest_dir}/bin/cloud-hypervisor-glibc" sed -i -E "s|(valid_hypervisor_paths) = .+|\1 = [\"${clh_path}\"]|" "${config_path}" sed -i -E "s|(path) = \".+/cloud-hypervisor\"|\1 = \"${clh_path}\"|" "${config_path}" @@ -483,7 +486,8 @@ function configure_containerd() { function remove_artifacts() { echo "deleting kata artifacts" - rm -rf ${dest_dir}/* + + rm -rf ${host_install_dir} if [[ "${CREATE_RUNTIMECLASSES}" == "true" ]]; then delete_runtimeclasses