Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
54892e3
chore(test): automate performance tests scenarios
universal-itengineer Sep 30, 2025
6665219
add netchecer, add bash scenarios
universal-itengineer Oct 2, 2025
d78d82a
fix evictor
universal-itengineer Oct 2, 2025
aa5c6a0
can run simple tests
universal-itengineer Oct 2, 2025
4cf97eb
change test run location
universal-itengineer Oct 3, 2025
37c2478
add scenarios
universal-itengineer Oct 3, 2025
1ca5c4c
fix scenarios
universal-itengineer Oct 6, 2025
0ea4bb4
upd deploy nc
universal-itengineer Oct 6, 2025
cdfe555
upd migration 10%
universal-itengineer Oct 6, 2025
1c61c65
comment scenarios
universal-itengineer Oct 7, 2025
dd5c3d5
update tests, refactor tools
universal-itengineer Oct 16, 2025
b0f0d9d
fix shatal,tests,config shatal
universal-itengineer Oct 17, 2025
a0e2801
add drain node
universal-itengineer Oct 17, 2025
eeb8316
add celanup report dir, change dir name for reports
universal-itengineer Oct 18, 2025
06fd197
upd report and migr function
universal-itengineer Oct 20, 2025
99ae69d
add scale deckhouse
universal-itengineer Oct 20, 2025
83f3386
add sleep befo migr
universal-itengineer Oct 20, 2025
366ad10
add wait virtualization controller ready
universal-itengineer Oct 20, 2025
ffcc0dd
add clean vmops afte migration steps
universal-itengineer Oct 20, 2025
bcdc422
upd migr conf
universal-itengineer Oct 20, 2025
7733aa3
GLOBAL_WAIT_TIME_STEP=5 dbg
universal-itengineer Oct 20, 2025
c738159
upd evicter and change value for netchecker
universal-itengineer Oct 20, 2025
eb3bc29
it works
universal-itengineer Oct 20, 2025
a2517c4
almost ready
universal-itengineer Oct 20, 2025
ee38ec8
add dbg script
universal-itengineer Oct 20, 2025
278080c
fix virtualization-dashboard
universal-itengineer Oct 21, 2025
81608b1
add batch install vm,vd
universal-itengineer Oct 22, 2025
071cfa4
add start_count
nevermarine Oct 22, 2025
c6831e9
add VI outside of count for old VDs
nevermarine Oct 22, 2025
3515cf1
add spaces
nevermarine Oct 22, 2025
3f27196
shatal: add GracePeriodSeconds 30
universal-itengineer Oct 23, 2025
ea9075a
update tests.sh
universal-itengineer Oct 23, 2025
11df6d8
add tool for gather logs from ns
universal-itengineer Oct 23, 2025
83e247b
add 15k vd deploy
universal-itengineer Oct 23, 2025
52b423a
add funcs date
universal-itengineer Oct 23, 2025
be6528d
fix vd deploy
universal-itengineer Oct 23, 2025
cdd349a
change disk type
universal-itengineer Oct 23, 2025
2294f48
upd logging for script
universal-itengineer Oct 23, 2025
80e3264
add dbg tasks for helm
universal-itengineer Oct 23, 2025
eb7d38e
pvc-snap
universal-itengineer Oct 23, 2025
9c35905
add annotation for vd
universal-itengineer Oct 23, 2025
1243b6b
add annotation for vd and vi
universal-itengineer Oct 23, 2025
ba86a6e
add creation custom cs
universal-itengineer Oct 23, 2025
6947f4b
fix wait pvc
universal-itengineer Oct 23, 2025
4ddfb7e
add virt perf dashboard
universal-itengineer Oct 23, 2025
3bd309e
add task for gather logs from ns
universal-itengineer Oct 24, 2025
b94abe4
change percentage from 5 to 10 for evicter
nevermarine Oct 27, 2025
dc4ed54
add --skip-cleanup and set parallel migrations to 50 for drain
nevermarine Oct 27, 2025
5907696
fix pipefail
nevermarine Oct 27, 2025
9065b60
replace everything with nelm
nevermarine Oct 27, 2025
5cc92b9
don't remove disks
nevermarine Oct 27, 2025
aaa80fa
parallel migrations from node = 50 during drain
nevermarine Oct 27, 2025
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
4 changes: 4 additions & 0 deletions tests/performance/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ includes:
taskfile: tools/evicter/Taskfile.yaml
dir: tools/evicter
optional: true
netchecker:
taskfile: tools/netchecker/Taskfile.dist.yaml
dir: tools/netchecker
optional: true

vars:
COUNT: '{{ .COUNT | default "1" }}'
Expand Down
19 changes: 18 additions & 1 deletion tests/performance/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ function validate_apply_args() {
function apply() {
echo "Apply resources: ${RESOURCES}"

args=( upgrade --install "${RELEASE_NAME}" . -n "${NAMESPACE}" --create-namespace --set "count=${COUNT}" --set "resourcesPrefix=${RESOURCES_PREFIX}" --set "resources.default=${RESOURCES}" )
args=( upgrade \
--install "${RELEASE_NAME}" . \
-n "${NAMESPACE}" \
--create-namespace \
--set "count=${COUNT}" \
--set "resourcesPrefix=${RESOURCES_PREFIX}" \
--set "resources.default=${RESOURCES}" \
--set "resources.virtualDisk.spec.template.type=${VIRTUALDISK_TYPE}" \
--set "resources.virtualImage.spec.template.type=${VIRTUALIMAGE_TYPE}" )

if [ -n "${STORAGE_CLASS}" ]; then
args+=( --set "resources.storageClassName=${STORAGE_CLASS}" )
fi
Expand Down Expand Up @@ -145,6 +154,14 @@ while [[ $# -gt 0 ]]; do
RESOURCES="$2"
shift 2
;;
--virtualDisk-type=*)
VIRTUALDISK_TYPE="${1#*=}"
shift
;;
--virtualImage-type=*)
VIRTUALIMAGE_TYPE="${1#*=}"
shift
;;
--resources-prefix=*|-p=*)
RESOURCES_PREFIX="${1#*=}"
shift
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions tests/performance/scenarios/deploy-prom-remote-writer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

kubectl apply -f - <<EOF
apiVersion: deckhouse.io/v1
kind: PrometheusRemoteWrite
metadata:
name: okmeter-sel-spb-2
spec:
customAuthToken: $OKMETER_AUTH_TOKEN
url: https://api.dop.flant.com/api/v1/push
writeRelabelConfigs:
- replacement: d8-virt-hetzner
targetLabel: dop_ha_cluster
- replacement: \$(POD_NAME)
targetLabel: dop_ha_replica
EOF
271 changes: 271 additions & 0 deletions tests/performance/scenarios/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
#!/usr/bin/env bash


# Global values
sleep_time=5


cd ..

exit_trap() {
echo ""
echo "Cleanup"
echo "Exiting..."
exit 0
}

format_duration() {
local total_seconds=$1
local hours=$((total_seconds / 3600))
local minutes=$(( (total_seconds % 3600) / 60 ))
local seconds=$((total_seconds % 60))
printf "%02d:%02d:%02d\n" "$hours" "$minutes" "$seconds"
}

formatted_date() {
date -d "@$1" +"%H:%M:%S %d-%m-%Y"
}

trap exit_trap SIGINT SIGTERM

undeploy_vm() {
task destroy:all

up=false

while [[ $up == false ]]; do
VDTotal=$(kubectl -n perf get vd -o name | wc -l)
VMTotal=$(kubectl -n perf get vm -o name | wc -l)

if [ $VDTotal -eq 0 ] && [ $VMTotal -eq 0 ]; then
up=true
echo "All vms and vds are destroyed"
echo "$(formatted_date $(date +%s))"
echo ""
break
fi

echo ""
echo "Waiting for vms and vds to be destroyed..."
echo "VM to destroy: $VMTotal"
echo "VD to destroy: $VDTotal"
echo ""
echo "Waiting for $sleep_time seconds..."
sleep $sleep_time
echo ""
done
}

cleanup_dir() {
local dir=$1
rm -rf $dir
}

default_storage_class() {
local STORAGE_CLASS=${1:-$STORAGE_CLASS}
if [ -n $STORAGE_CLASS ]; then
echo $STORAGE_CLASS
else
kubectl get storageclass -o json \
| jq -r '.items[] | select(.metadata.annotations."storageclass.kubernetes.io/is-default-class" == "true") | .metadata.name'
fi
}


deploy_resources() {
# available resource types: all, vm, vd
local resourceType=${1:-"all"}
local VIType=$2
local COUNT=${3:-10}
local report_dir=${4:-"report/statistics"}

if [ -z $VIType ]; then
echo "VIType is requared"
echo "Supported types: virtualImage, persistentVolumeClaim"
exit 1
fi

echo "Create vd from ${VIType}"
echo ""

case $resourceType in
"all")
task apply:all \
COUNT=${COUNT} \
STORAGE_CLASS=$(default_storage_class) \
VIRTUALDISK_TYPE=virtualDisk \
VIRTUALIMAGE_TYPE=${VIType}
;;
"vm")
task apply:vms \
COUNT=${COUNT} \
NAMESPACE=perf \
VIRTUALDISK_TYPE=virtualDisk \
VIRTUALIMAGE_TYPE=${VIType}
;;
"vd")
task apply:disks \
COUNT=${COUNT} \
NAMESPACE=perf \
VIRTUALDISK_TYPE=virtualDisk \
VIRTUALIMAGE_TYPE=${VIType}
;;
*)
echo "Unknown resource type: $resourceType"
exit 1
;;
esac

dir_virtualDisk="${report_dir}/vm_vi_${VIType}"
mkdir -p ${dir_virtualDisk}

up=false
start_time=$(date +%s)

echo "Test vm with virtualDisk from ${VIType}" > ${dir_virtualDisk}/report_vm_virtualDisk.txt
echo "Start time: $(formatted_date $start_time)" >> ${dir_virtualDisk}/report_vm_virtualDisk.txt

while [[ $up == false ]]; do
VDReady=$(kubectl -n perf get vd | grep "Ready" | wc -l)
VDTotal=$(kubectl -n perf get vd -o name | wc -l)

VMReady=$(kubectl -n perf get vm | grep "Running" | wc -l)
VMTotal=$(kubectl -n perf get vm -o name | wc -l)

if [ $VDReady -eq $VDTotal ] && [ $VMReady -eq $VMTotal ]; then
up=true
echo "All vms and vds are ready"
end_time=$(date +%s)
break
fi

echo ""
echo "Waiting for vms and vds to be ready..."
echo "VM Running: $VMReady/$VMTotal"
echo "VD Ready: $VDReady/$VDTotal"
echo ""
echo "Waiting for $sleep_time seconds..."
sleep $sleep_time
echo ""
done

duration=$((end_time - start_time))
formatted_duration=$(format_duration "$duration")
echo "Duration: $duration seconds"
echo "Execution time: $formatted_duration"

echo "Execution time: $formatted_duration" >> ${dir_virtualDisk}/report_vm_virtualDisk.txt
echo "End time: $(formatted_date $end_time)" >> ${dir_virtualDisk}/report_vm_virtualDisk.txt

echo ""

}

gather_all_statistics() {
local report_dir=${1:-"report/statistics"}
task statistic:get-stat:all

mv tools/statistic/*.csv ${report_dir}
}

gather_vm_statistics() {
local report_dir=${1:-"report/statistics"}
task statistic:get-stat:vm

mv tools/statistic/*.csv ${report_dir}
}

gather_vd_statistics() {
local report_dir=${1:-"report/statistics"}
task statistic:get-stat:vd

mv tools/statistic/*.csv ${report_dir}
}

start_migration() {
# supoprt duration format: 0m - infinite, 30s - 30 seconds, 1h - 1 hour, 2h30m - 2 hours and 30 minutes
local duration=${1:-"5m"}
local SESSION="test-perf"

echo "Create tmux session: $SESSION"
tmux -2 new-session -d -s "${SESSION}"

tmux new-window -t "$SESSION:1" -n "perf"
tmux split-window -h -t 0 # Pane 0 (left), Pane 1 (right)
tmux split-window -v -t 1 # Pane 1 (top), Pane 2 (bottom)

tmux select-pane -t 0
tmux send-keys "k9s -n perf" C-m
tmux resize-pane -t 1 -x 50%

echo "Start migration in $SESSION, pane 1"
tmux select-pane -t 1
tmux send-keys "NS=perf TARGET=5 DURATION=${duration} task evicter:run:migration" C-m
tmux resize-pane -t 1 -x 50%

tmux select-pane -t 2
tmux resize-pane -t 2 -x 50%
echo "For watching migration in $SESSION, connect to session with command:"
echo "tmux -2 attach -t ${SESSION}"
echo ""

}

stop_migration() {
local SESSION="test-perf"
tmux -2 kill-session -t "${SESSION}" || true
}

restart_virtualization_components() {
kubectl -n d8-virtualization rollout restart deployment virtualization-controller
}

collect_vpa() {
local vpa_dir="report/vpa"
mkdir -p ${vpa_dir}
local VPAS=( $(kubectl -n d8-virtualization get vpa -o name) )

for vpa in $VPAS; do
vpa_name=$(echo $vpa | cut -d "/" -f2)
file="vpa_${vpa_name}.yaml"
kubectl -n d8-virtualization get $vpa -o yaml > "${vpa_dir}/${file}_$(formatted_date $(date +%s))"
done
}

# test only
for vitype in "virtualImage" "persistentVolumeClaim"; do
cleanup_dir "report"
done

# all resources
vi_type="virtualImage"
migration_duration="1m"
main_sleep=$( echo "$migration_duration" | sed 's/m//' )
count=5

# undeploy_vm
# sleep 5
# deploy_resources "all" $vi_type $count
# sleep 1
# start_migration "$migration_duration"
# sleep $(( $main_sleep * 60 ))
# stop_migration
# sleep 5
# gather_all_statistics "report/statistics/vm_vi_${vi_type}"
# collect_vpa


vi_type="persistentVolumeClaim"
undeploy_vm
sleep 5
deploy_resources "all" $vi_type $count
sleep 1
start_migration "$migration_duration"
sleep $(( $main_sleep * 60 ))
stop_migration
sleep 5
gather_all_statistics "report/statistics/vm_vi_${vi_type}"
collect_vpa

# vd only

Loading
Loading