Vasyl Saienko | 775c1da | 2023-07-13 11:34:25 +0000 | [diff] [blame^] | 1 | EXAMPLES_DIR=$(cd $(dirname "$0")/.. && pwd) |
2 | WORKDIR=$(cd $(dirname "$0") && pwd) | ||||
3 | source ${EXAMPLES_DIR}/lib.sh | ||||
4 | |||||
5 | command=$1 | ||||
6 | |||||
7 | function run { | ||||
8 | echo "Creating VM" | ||||
9 | kubectl apply -f cirros-boot-vm.yaml | ||||
10 | |||||
11 | echo "Starting VM" | ||||
12 | virtctl start cirros-boot-vm | ||||
13 | |||||
14 | echo "Waiting VM is Running." | ||||
15 | wait_vm_state cirros-boot-vm Running | ||||
16 | } | ||||
17 | |||||
18 | function cleanup { | ||||
19 | kubectl delete -f cirros-boot-vm.yaml | ||||
20 | } | ||||
21 | |||||
22 | pushd $WORKDIR | ||||
23 | $command | ||||
24 | popd |