Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

ci: add k8s uninstallation to metrics tests #4206

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions .ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,21 @@ gen_clean_arch() {
info "remove containers started by ctr"
clean_env_ctr

# reset k8s service may impact metrics test on x86_64
[ $(uname -m) != "x86_64" -a "$(pgrep kubelet)" != "" ] && sudo sh -c 'kubeadm reset -f'
info "Remove installed kubernetes packages and configuration"
if [ "$ID" == ubuntu ]; then
sudo rm -rf /etc/systemd/system/kubelet.service.d
dborquez marked this conversation as resolved.
Show resolved Hide resolved
sudo systemctl daemon-reload
sudo apt-get autoremove -y kubeadm kubelet kubectl
fi

# Remove existing k8s related configurations and binaries.
sudo sh -c 'rm -rf /opt/cni/bin/*'
sudo sh -c 'rm -rf /etc/cni /etc/kubernetes/'
sudo sh -c 'rm -rf /var/lib/cni /var/lib/etcd /var/lib/kubelet'
sudo sh -c 'rm -rf /run/flannel'

if [[ $CI_JOB != "METRICS" ]]; then
info "delete stale kata resource under ${stale_kata_dir_union[@]}"
delete_stale_kata_resource
Expand All @@ -357,28 +372,14 @@ gen_clean_arch() {
delete_crio_stale_resource
info "Remove installed containerd-cri related binaries and configuration"
delete_containerd_cri_stale_resource
fi

if [[ $CI_JOB != "METRICS" ]]; then
#reset k8s service may impact metrics test on x86_64, so limit it to arm64
[ $(uname -m) == "aarch64" -a "$(pgrep kubelet)" != "" ] && sudo sh -c 'kubeadm reset -f'
info "Remove installed kubernetes packages and configuration"
if [ "$ID" == ubuntu ]; then
sudo rm -rf /etc/systemd/system/kubelet.service.d
sudo apt-get autoremove -y kubeadm kubelet kubectl \
$(dpkg -l | awk '{print $2}' | grep -E '^(containerd(.\io)?|docker(\.io|-ce(-cli)?))$')
sudo apt-get autoremove -y $(dpkg -l | awk '{print $2}' | grep -E '^(containerd(.\io)?|docker(\.io|-ce(-cli)?))$')
fi
# Remove existing k8s related configurations and binaries.
sudo sh -c 'rm -rf /opt/cni/bin/*'
sudo sh -c 'rm -rf /etc/cni /etc/kubernetes/'
sudo sh -c 'rm -rf /var/lib/cni /var/lib/etcd /var/lib/kubelet'
sudo sh -c 'rm -rf /run/flannel'

info "Clean up stale network interface"
dborquez marked this conversation as resolved.
Show resolved Hide resolved
cleanup_network_interface
fi

if [[ $CI_JOB != "METRICS" ]]; then
info "Remove Kata package repo registrations"
dborquez marked this conversation as resolved.
Show resolved Hide resolved
delete_kata_repo_registrations
fi
Expand Down
1 change: 0 additions & 1 deletion .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ case "${CI_JOB}" in
sudo -E ln -sf "${config_path}/configuration-qemu.toml" "${config_path}/configuration.toml"
echo "INFO: Running qemu metrics tests"
sudo -E PATH="$PATH" ".ci/run_metrics_PR_ci.sh"
echo "INFO: Running cloud hypervisor metrics tests"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you remove this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is useful to have it to mark the cloud hypervisor start

Copy link
Contributor Author

@dborquez dborquez Feb 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GabyCT , that info msg is located before the test starts, in the same way the msg for qemu does:

echo "INFO: Running cloud hypervisor metrics tests"

export KATA_HYPERVISOR="cloud-hypervisor"
tests_repo="github.com/kata-containers/tests"
pushd "${GOPATH}/src/${tests_repo}"
Expand Down
10 changes: 4 additions & 6 deletions .ci/run_metrics_PR_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ run() {
# Run the memory footprint test - the main test that
# KSM affects.
bash density/memory_usage.sh 20 300 auto

# And now ensure KSM is turned off for the rest of the tests
disable_ksm
fi
fi

Expand All @@ -64,9 +61,10 @@ run() {
# Run the time tests
bash time/launch_times.sh -i public.ecr.aws/ubuntu/ubuntu:latest -n 20

# Skip: Issue: https://github.com/kata-containers/tests/issues/3203
# Run the cpu statistics test
# bash network/cpu_statistics_iperf.sh
if [ "${KATA_HYPERVISOR}" = "cloud-hypervisor" ]; then
# Run the cpu statistics test
bash network/iperf3_kubernetes/k8s-network-metrics-iperf3.sh -b
fi

popd
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ checktype = "mean"
midval = 55700.0
minpercent = 10.0
maxpercent = 10.0

[[metric]]
name = "network-iperf3-bandwidth"
type = "json"
description = "measure container bandwidth using iperf3"
# Min and Max values to set a 'range' that
# the median of the CSV Results data must fall
# within (inclusive)
checkvar = ".\"network-iperf3-bandwidth\".Results | .[] | .bandwidth.Result"
checktype = "mean"
midval = 42241350194.0
minpercent = 10.0
maxpercent = 10.0
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ source "${SCRIPT_PATH}/../../../.ci/lib.sh"
source "${SCRIPT_PATH}/../../lib/common.bash"
test_repo="${test_repo:-github.com/kata-containers/tests}"
iperf_file=$(mktemp iperfresults.XXXXXXXXXX)
TEST_NAME="${TEST_NAME:-IPerf}"

function remove_tmp_file() {
rm -rf "${iperf_file}"
Expand Down Expand Up @@ -208,6 +209,8 @@ EOF
}

function main() {
init_env

local OPTIND
while getopts ":abcjh:" opt
do
Expand Down