From bead9c7dfc3f0a35b948d931bac26b9c780e8c71 Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Mon, 29 Jul 2019 15:54:19 +0100 Subject: [PATCH] metrics: use RUNTIME to determine RuntimeClass If we have $RUNTIME set in the env, then we set up the pod RuntimeClass, otherwise, just use the default node runtimes. Clean up some of the un-used library code around docker/RUNTIME as well whilst we are there. Signed-off-by: Graham Whaley --- metrics/lib/common.bash | 19 ------------------- metrics/lib/kata-common.bash | 18 ------------------ metrics/scaling/k8s_scale.sh | 6 +----- 3 files changed, 1 insertion(+), 42 deletions(-) diff --git a/metrics/lib/common.bash b/metrics/lib/common.bash index 6de63b9..adcee14 100755 --- a/metrics/lib/common.bash +++ b/metrics/lib/common.bash @@ -14,7 +14,6 @@ source /etc/os-release || source /usr/lib/os-release # Set variables to reasonable defaults if unset or empty DOCKER_EXE="${DOCKER_EXE:-docker}" -RUNTIME="${RUNTIME:-kata-runtime}" KSM_BASE="/sys/kernel/mm/ksm" KSM_ENABLE_FILE="${KSM_BASE}/run" @@ -188,23 +187,6 @@ show_system_state() { done } -common_init(){ - - # If we are running a kata runtime, go extract its environment - # for later use. - local iskata=$(is_a_kata_runtime "$RUNTIME") - - if [ "$iskata" == "1" ]; then - extract_kata_env - else - # We know we have nothing to do for runc - if [ "$RUNTIME" != "runc" ]; then - warning "Unrecognised runtime ${RUNTIME}" - fi - fi -} - - # Save the current KSM settings so we can restore them later save_ksm_settings(){ echo "saving KSM settings" @@ -307,4 +289,3 @@ wait_ksm_settle(){ echo "Timed out after ${1}s waiting for KSM to settle" } -common_init diff --git a/metrics/lib/kata-common.bash b/metrics/lib/kata-common.bash index 6b500b1..96bfcb8 100755 --- a/metrics/lib/kata-common.bash +++ b/metrics/lib/kata-common.bash @@ -31,24 +31,6 @@ info() { echo "INFO: $msg" } -# Check if the $1 argument is the name of a 'known' -# Kata runtime. Of course, the end user can choose any name they -# want in reality, but this function knows the names of the default -# and recommended Kata docker runtime install names. -is_a_kata_runtime(){ - case "$1" in - "kata-runtime") ;& # fallthrough - "kata-qemu") ;& # fallthrough - "kata-fc") - echo "1" - return - ;; - esac - - echo "0" -} - - # Try to find the real runtime path for the docker runtime passed in $1 get_docker_kata_path(){ local jpaths=$(docker info --format "{{json .Runtimes}}" || true) diff --git a/metrics/scaling/k8s_scale.sh b/metrics/scaling/k8s_scale.sh index ffa38e8..8bdb064 100755 --- a/metrics/scaling/k8s_scale.sh +++ b/metrics/scaling/k8s_scale.sh @@ -18,7 +18,6 @@ deployment="busybox" stats_pod="stats" -export RUNTIME="kata-qemu" NUM_PODS=${NUM_PODS:-20} STEP=${STEP:-1} @@ -29,7 +28,6 @@ LABELVALUE=${LABELVALUE:-gandalf} wait_time=${wait_time:-30} delete_wait_time=${delete_wait_time:-600} settle_time=${settle_time:-5} -use_kata_runtime=${use_kata_runtime:-no} use_api=${use_api:-yes} # Set some default metrics env vars @@ -165,7 +163,7 @@ run() { # Generate the next yaml file local runtime_command - if [ "$use_kata_runtime" != "no" ]; then + if [ -n "$RUNTIME" ]; then runtime_command="s|@RUNTIMECLASS@|${RUNTIME}|g" else runtime_command="/@RUNTIMECLASS@/d" @@ -271,8 +269,6 @@ show_vars() echo -e "\t\tSeconds to wait for all pods to be deleted" echo -e "\tsettle_time (${settle_time})" echo -e "\t\tSeconds to wait after pods ready before taking measurements" - echo -e "\tuse_kata_runtime (${use_kata_runtime})" - echo -e "\t\tspecify yes or no to use kata runtime" echo -e "\tuse_api (${use_api})" echo -e "\t\tspecify yes or no to use the API to launch pods" }