mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 07:48:55 +00:00
tests/k8s: add function to install kbs-client
Added kbs_install_cli function to build and install the kbs-client executable if not present into the system. Removed the stub from gha-run.sh; now the install kbs-client in the .github/workflows/run-kata-deploy-tests-on-aks.yaml will effectively install the executable. Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
4141875ffd
commit
2a374422c5
@ -14,6 +14,8 @@ set -o pipefail
|
|||||||
kubernetes_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
kubernetes_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
# shellcheck disable=1091
|
# shellcheck disable=1091
|
||||||
source "${kubernetes_dir}/../../gha-run-k8s-common.sh"
|
source "${kubernetes_dir}/../../gha-run-k8s-common.sh"
|
||||||
|
# shellcheck disable=1091
|
||||||
|
source "${kubernetes_dir}/../../../ci/lib.sh"
|
||||||
|
|
||||||
# Where the kbs sources will be cloned
|
# Where the kbs sources will be cloned
|
||||||
readonly COCO_KBS_DIR="/tmp/kbs"
|
readonly COCO_KBS_DIR="/tmp/kbs"
|
||||||
@ -22,6 +24,38 @@ readonly KBS_NS="coco-tenant"
|
|||||||
# The kbs service name
|
# The kbs service name
|
||||||
readonly KBS_SVC_NAME="kbs"
|
readonly KBS_SVC_NAME="kbs"
|
||||||
|
|
||||||
|
# Build and install the kbs-client binary, unless it is already present.
|
||||||
|
#
|
||||||
|
kbs_install_cli() {
|
||||||
|
command -v kbs-client >/dev/null && return
|
||||||
|
|
||||||
|
if ! command -v apt >/dev/null; then
|
||||||
|
>&2 echo "ERROR: running on unsupported distro"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local pkgs="build-essential"
|
||||||
|
|
||||||
|
sudo apt-get update -y
|
||||||
|
# shellcheck disable=2086
|
||||||
|
sudo apt-get install -y $pkgs
|
||||||
|
|
||||||
|
# Mininum required version to build the client (read from versions.yaml)
|
||||||
|
local rust_version
|
||||||
|
ensure_yq
|
||||||
|
rust_version=$(get_from_kata_deps "externals.coco-kbs.toolchain")
|
||||||
|
# Currently kata version from version.yaml is 1.72.0
|
||||||
|
# which doesn't match the requirement, so let's pass
|
||||||
|
# the required version.
|
||||||
|
_ensure_rust "$rust_version"
|
||||||
|
|
||||||
|
pushd "${COCO_KBS_DIR}/kbs"
|
||||||
|
# Compile with sample features to bypass attestation.
|
||||||
|
make CLI_FEATURES=sample_only cli
|
||||||
|
sudo make install-cli
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
# Delete the kbs on Kubernetes
|
# Delete the kbs on Kubernetes
|
||||||
#
|
#
|
||||||
# Note: assume the kbs sources were cloned to $COCO_KBS_DIR
|
# Note: assume the kbs sources were cloned to $COCO_KBS_DIR
|
||||||
@ -194,6 +228,37 @@ kbs_k8s_svc_http_addr() {
|
|||||||
echo "http://${host}:${port}"
|
echo "http://${host}:${port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ensure rust is installed in the host.
|
||||||
|
#
|
||||||
|
# It won't install rust if it's already present, however, if the current
|
||||||
|
# version isn't greater or equal than the mininum required then it will
|
||||||
|
# bail out with an error.
|
||||||
|
#
|
||||||
|
_ensure_rust() {
|
||||||
|
rust_version=${1:-}
|
||||||
|
|
||||||
|
if ! command -v rustc >/dev/null; then
|
||||||
|
"${kubernetes_dir}/../../install_rust.sh" "${rust_version}"
|
||||||
|
|
||||||
|
# shellcheck disable=1091
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
else
|
||||||
|
[ -z "$rust_version" ] && return
|
||||||
|
|
||||||
|
# We don't want to mess with installation on bare-metal so
|
||||||
|
# if rust is installed then just check it's >= the required
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
local current_rust_version
|
||||||
|
current_rust_version="$(rustc --version | cut -d' ' -f2)"
|
||||||
|
if ! version_greater_than_equal "${current_rust_version}" \
|
||||||
|
"${rust_version}"; then
|
||||||
|
>&2 echo "ERROR: installed rust $current_rust_version < $rust_version (required)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Choose the appropriated ingress handler.
|
# Choose the appropriated ingress handler.
|
||||||
#
|
#
|
||||||
# To add a new handler, create a function named as _handle_ingress_NAME where
|
# To add a new handler, create a function named as _handle_ingress_NAME where
|
||||||
|
@ -191,7 +191,7 @@ function deploy_kata() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function install_kbs_client() {
|
function install_kbs_client() {
|
||||||
echo "TODO: install kbs-client - https://github.com/kata-containers/kata-containers/pull/9114"
|
kbs_install_cli
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_tests() {
|
function run_tests() {
|
||||||
|
@ -205,6 +205,7 @@ externals:
|
|||||||
version: "18c8ee378c6d83446ee635a702d5dee389028d8f"
|
version: "18c8ee378c6d83446ee635a702d5dee389028d8f"
|
||||||
image: "ghcr.io/confidential-containers/staged-images/kbs"
|
image: "ghcr.io/confidential-containers/staged-images/kbs"
|
||||||
image_tag: "18c8ee378c6d83446ee635a702d5dee389028d8f"
|
image_tag: "18c8ee378c6d83446ee635a702d5dee389028d8f"
|
||||||
|
toolchain: "1.74.0"
|
||||||
|
|
||||||
conmon:
|
conmon:
|
||||||
description: "An OCI container runtime monitor"
|
description: "An OCI container runtime monitor"
|
||||||
|
Loading…
Reference in New Issue
Block a user