Skip to content

Commit

Permalink
Merge pull request kata-containers#4986 from studychao/chao/merge_run…
Browse files Browse the repository at this point in the history
…timers_to_main

merge runtime-rs to main
  • Loading branch information
liubin authored Aug 11, 2022
2 parents f15ec00 + 58c7ec0 commit f46a863
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 12 deletions.
9 changes: 8 additions & 1 deletion .ci/ci_job_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,12 @@ case "${CI_JOB}" in
export KATA_HYPERVISOR="qemu"
export KUBERNETES="yes"
export METRICS_CI=1
;;
;;
"DRAGONBALL")
init_ci_flags
export CRI_CONTAINERD="yes"
export CRI_RUNTIME="containerd"
export KATA_HYPERVISOR="dragonball"
export KUBERNETES="yes"
;;
esac
3 changes: 3 additions & 0 deletions .ci/install_kata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ case "${KATA_HYPERVISOR}" in
echo "Installing virtiofsd"
"${cidir}/install_virtiofsd.sh"
;;
"dragonball")
echo "Kata Hypervisor is dragonball"
;;
*)
die "${KATA_HYPERVISOR} not supported for CI install"
;;
Expand Down
12 changes: 12 additions & 0 deletions .ci/install_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ OPENSHIFT_CI="${OPENSHIFT_CI:-false}"
runtime_config_path="${SYSCONFDIR}/kata-containers/configuration.toml"
runtime_src_path="${katacontainers_repo_dir}/src/runtime"
agent_ctl_path="${katacontainers_repo_dir}/src/tools/agent-ctl"
runtime_rs_src_path="${katacontainers_repo_dir}/src/runtime-rs"

PKGDEFAULTSDIR="${DESTDIR}${SHAREDIR}/defaults/kata-containers"
NEW_RUNTIME_CONFIG="${PKGDEFAULTSDIR}/configuration.toml"
Expand All @@ -58,6 +59,14 @@ build_install_shim_v2(){
make
sudo -E PATH=$PATH make install
popd
if [ "$KATA_HYPERVISOR" == "dragonball" ]; then
bash "${cidir}/install_rust.sh" && source "$HOME/.cargo/env"
pushd "$runtime_rs_src_path"
sudo chown -R "${USER}:" "${katacontainers_repo_dir}"
make
sudo -E PATH=$PATH make install
popd
fi
}

build_install_shim_v2
Expand Down Expand Up @@ -109,6 +118,9 @@ case "${KATA_HYPERVISOR}" in
sudo sed -i 's|^cpu_features="|cpu_features="-vmx-rdseed-exit,|g' "${runtime_config_path}"
fi
;;
"dragonball")
enable_hypervisor_config "${PKGDEFAULTSDIR}/configuration-dragonball.toml"
;;
*)
die "failed to enable config for '${KATA_HYPERVISOR}', not supported"
;;
Expand Down
12 changes: 12 additions & 0 deletions .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ case "${CI_JOB}" in
"VIRTIOFS_EXPERIMENTAL")
sudo -E PATH="$PATH" bash -c "make filesystem"
;;
"DRAGONBALL")
# TODO: currently runtime-rs binary doesn't support nydus, so disable nydus testing.
# Please refer to the issue: https://github.com/kata-containers/kata-containers/issues/4690
# echo "INFO: Running nydus test"
# sudo -E PATH="$PATH" CRI_RUNTIME="containerd" bash -c "make nydus"
echo "INFO: Running stability test"
sudo -E PATH="$PATH" CRI_RUNTIME="containerd" bash -c "make dragonball-stability"
echo "INFO: Containerd checks"
sudo -E PATH="$PATH" bash -c "make cri-containerd"
echo "INFO: Running kubernetes tests"
sudo -E PATH="$PATH" CRI_RUNTIME="containerd" bash -c "make kubernetes"
;;
*)
echo "INFO: Running checks"
sudo -E PATH="$PATH" bash -c "make check"
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ stability:
ITERATIONS=2 MAX_CONTAINERS=20 ./soak_parallel_rm.sh
cd stability && ./hypervisor_stability_kill_test.sh

# If hypervisor is dragonball, the default path to keep pod info is /run/kata. Meanwhile, there is
# no independent hypervisor process for dragonball, so disale hypervisor_stability_kill_test.sh
dragonball-stability:
cd stability && ITERATIONS=2 MAX_CONTAINERS=20 VC_POD_DIR=/run/kata ./soak_parallel_rm.sh

# Run the static checks on this repository.
static-checks:
PATH="$(GOPATH)/bin:$(PATH)" .ci/static-checks.sh \
Expand Down
7 changes: 5 additions & 2 deletions integration/containerd/cri/integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,11 @@ main() {
make GO_BUILDTAGS="no_btrfs" -e cri-integration
done

TestContainerMemoryUpdate 1
TestContainerMemoryUpdate 0
# TODO: runtime-rs doesn't support memory update currently
if [ "$KATA_HYPERVISOR" != "dragonball" ]; then
TestContainerMemoryUpdate 1
TestContainerMemoryUpdate 0
fi

TestKilledVmmCleanup

Expand Down
34 changes: 34 additions & 0 deletions integration/kubernetes/run_kubernetes_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,40 @@ else
"k8s-ro-volume.bats" \
"k8s-nginx-connectivity.bats" \
"k8s-hugepages.bats")
# TODO: runtime-rs doesn't support the following test cases, and will be fixed/improved in the future:
# k8s-block-volume.bats, k8s-copy-file.bats, k8s-cpu-ns.bats, k8s-empty-dirs.bats, k8s-expose-ip.bats,
# k8s-hugepages.bats, k8s-inotify.bats, k8s-liveness-probes.bats, k8s-nginx-connectivity.bats,
# k8s-pid-ns.bats, k8s-ro-volume.bats
if [ "$KATA_HYPERVISOR" == "dragonball" ]; then
K8S_TEST_UNION=("k8s-attach-handlers.bats" \
"k8s-caps.bats" \
"k8s-configmap.bats" \
"k8s-credentials-secrets.bats" \
"k8s-custom-dns.bats" \
"k8s-env.bats" \
"k8s-exec.bats" \
"k8s-job.bats" \
"k8s-limit-range.bats" \
"k8s-memory.bats" \
"k8s-nested-configmap-secret.bats" \
"k8s-number-cpus.bats" \
"k8s-oom.bats" \
"k8s-optional-empty-configmap.bats" \
"k8s-optional-empty-secret.bats" \
"k8s-parallel.bats" \
"k8s-pod-quota.bats" \
"k8s-port-forward.bats" \
"k8s-projected-volume.bats" \
"k8s-qos-pods.bats" \
"k8s-replication.bats" \
"k8s-scale-nginx.bats" \
"k8s-seccomp.bats" \
"k8s-sysctls.bats" \
"k8s-security-context.bats" \
"k8s-shared-volume.bats" \
"k8s-volume.bats" \
)
fi
fi

cleanup() {
Expand Down
5 changes: 4 additions & 1 deletion lib/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ extract_kata_env() {
SHIM_VERSION=${RUNTIME_VERSION}

HYPERVISOR_PATH=$(kata-runtime kata-env --json | jq -r .Hypervisor.Path)
HYPERVISOR_VERSION=$(${HYPERVISOR_PATH} --version | head -n1)
# TODO: there is no kata-runtime of rust version currently
if [ "${KATA_HYPERVISOR}" != "dragonball" ]; then
HYPERVISOR_VERSION=$(${HYPERVISOR_PATH} --version | head -n1)
fi
VIRTIOFSD_PATH=$(kata-runtime kata-env --json | jq -r .Hypervisor.VirtioFSDaemon)

INITRD_PATH=$(kata-runtime kata-env --json | jq -r .Initrd.Path)
Expand Down
20 changes: 12 additions & 8 deletions stability/soak_parallel_rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,23 @@ check_all_running() {
fi

# check we have the right number of vm's
how_many_vms=$(pgrep -a $(basename ${HYPERVISOR_PATH} | cut -d '-' -f1) | wc -l)
if (( ${how_many_running} != ${how_many_vms} )); then
echo "Wrong number of $KATA_HYPERVISOR running (${how_many_running} != ${how_many_vms}) - stopping"
((goterror++))
if [[ "$KATA_HYPERVISOR" != "dragonball" ]]; then
how_many_vms=$(pgrep -a $(basename ${HYPERVISOR_PATH} | cut -d '-' -f1) | wc -l)
if (( ${how_many_running} != ${how_many_vms} )); then
echo "Wrong number of $KATA_HYPERVISOR running (${how_many_running} != ${how_many_vms}) - stopping"
((goterror++))
fi
fi

# if this is kata-runtime, check how many pods virtcontainers thinks we have
if [[ "$RUNTIME" == "containerd-shim-kata-v2" ]]; then
num_vc_pods=$(sudo ls -1 ${VC_POD_DIR} | wc -l)
if [ -d "${VC_POD_DIR}" ]; then
num_vc_pods=$(sudo ls -1 ${VC_POD_DIR} | wc -l)

if (( ${how_many_running} != ${num_vc_pods} )); then
echo "Wrong number of pods in $VC_POD_DIR (${how_many_running} != ${num_vc_pods}) - stopping)"
((goterror++))
if (( ${how_many_running} != ${num_vc_pods} )); then
echo "Wrong number of pods in $VC_POD_DIR (${how_many_running} != ${num_vc_pods}) - stopping)"
((goterror++))
fi
fi
fi
fi
Expand Down

0 comments on commit f46a863

Please sign in to comment.