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 network attachments" |
| 9 | kubectl apply -f network-attachment.yaml |
| 10 | |
| 11 | echo "Creating VMs" |
| 12 | for vm in cirros-net1 cirros-net2; do |
| 13 | kubectl apply -f $vm.yaml |
| 14 | |
| 15 | echo "Starting VM $vm" |
| 16 | virtctl start $vm |
| 17 | done |
| 18 | echo "Waiting VM is Running." |
| 19 | wait_vm_state cirros-net1 Running |
| 20 | wait_vm_state cirros-net2 Running |
| 21 | } |
| 22 | |
| 23 | function cleanup { |
| 24 | for f in $(ls *.yaml); do |
| 25 | kubectl delete -f $f |
| 26 | done |
| 27 | } |
| 28 | |
| 29 | pushd $WORKDIR |
| 30 | $command |
| 31 | popd |