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 PVC" |
| 9 | kubectl apply -f pvc.yaml |
| 10 | |
| 11 | echo "Creating VM" |
| 12 | kubectl apply -f cirros.yaml |
| 13 | |
| 14 | echo "Starting VM" |
| 15 | virtctl start cirros-volumes |
| 16 | |
| 17 | echo "Waiting VM is Running." |
| 18 | wait_vm_state cirros-volumes Running |
| 19 | } |
| 20 | |
| 21 | function cleanup { |
| 22 | kubectl delete -f cirros.yaml |
| 23 | kubectl delete -f pvc.yaml |
| 24 | } |
| 25 | |
| 26 | pushd $WORKDIR |
| 27 | $command |
| 28 | popd |