3 printf "\n\nStart Virtlet VM provisioning E2E test\n\n"
5 TUNING_DIR="/tmp/tuning_dir"
6 CNI_PLUGINS="cni-plugins-linux-amd64-v0.8.2.tgz"
7 if !(wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/$CNI_PLUGINS -P $TUNING_DIR 2>/dev/null); then
8 echo "Error downloading cni plugins for Virtlet VM provisioning"
13 if [ -f $CNI_PLUGINS ]; then
14 tar -xzvf $CNI_PLUGINS > /dev/null
15 if [ -f "tuning" ]; then
16 cp "tuning" "/opt/cni/bin/"
17 echo "Updated the tuning plugin"
19 echo "Error finding the latest tuning plugin"
27 # create flannel-vm net-attach-def
28 kubectl apply -f ../deploy/netattachdef-flannel-vm.yaml -n kube-system
30 # generate user ssh key
31 if [ ! -f "/root/.ssh/id_rsa.pub" ]; then
32 ssh-keygen -f /root/.ssh/id_rsa -P ""
36 key=$(cat /root/.ssh/id_rsa.pub)
37 cp ../deploy/virtlet-deployment-sample.yaml virtlet_test_vm.yaml
38 sed -i "s|\$ssh_key|${key}|" virtlet_test_vm.yaml
39 kubectl create -f virtlet_test_vm.yaml
42 while [[ $status != "Running" ]]
44 stats=$(kubectl get pods |grep -i virtlet-deployment)
45 status=$(echo $stats | cut -d " " -f 3)
46 if [[ $status == "Err"* ]]; then
47 echo "Error creating Virtlet VM, test incomplete"
48 kubectl delete -f virtlet_test_vm.yaml
54 echo "Virtlet VM is ready for provisioning"
56 printf "\nkubectl get pods $(kubectl get pods |grep -i virtlet-deployment | awk '{print $1}') -o json\n"
57 podjson=$(kubectl get pods $(kubectl get pods |grep -i virtlet-deployment | awk '{print $1}') -o json)
58 printf "\n$podjson\n\n"
60 # create provisioning cr
61 kubectl apply -f e2e_virtletvm_test_provisioning_cr.yaml
67 while [[ $status == "Running" ]]
69 stats=$(kubectl get pods |grep -i kud-cluster-vm)
70 status=$(echo $stats | cut -d " " -f 3)
71 echo "KUD install job still running"
75 if [[ $status == "Completed" ]]; then
76 printf "KUD Install completed successfully\n"
78 printf "KUD Install failed\n"
81 printf "\nPrinting kud-cluster-vm job logs....\n\n"
82 kudjob=$(kubectl get pods | grep -i kud-cluster-vm | awk '{print $1}')
83 printf "$(kubectl logs $kudjob)\n"
85 printf "\n\nBeginning E2E VM Test Teardown\n\n"
87 kubectl delete -f e2e_virtletvm_test_provisioning_cr.yaml
88 kubectl delete job kud-cluster-vm
89 kubectl delete configmap cluster-vm-configmap
90 kubectl delete -f virtlet_test_vm.yaml