Skip to content

Commit

Permalink
Move vagrant stuff to contrib/vagrant
Browse files Browse the repository at this point in the history
Change-Id: I36f226d8830a2f0f2a1e0ac0753303f877cadc27
Signed-off-by: Fabian Deutsch <[email protected]>
  • Loading branch information
fabiand authored and Gerrit Code Review committed Dec 13, 2016
1 parent c2e57d8 commit 0b084e3
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ cluster/manifest/*.yaml
**/bin
bin/*
.vagrant
cluster/.kubeconfig
cluster/.kubectl
contrib/vagrant/.kubeconfig
contrib/vagrant/.kubectl
*_swagger_generated.go
*_swagger_generated_test.go
build-tools/desc/desc
6 changes: 3 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Vagrant.configure(2) do |config|
if $use_nfs then
config.vm.synced_folder "./", "/vagrant", type: "nfs"
else
config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__exclude: [ "cluster/.kubectl", "cluster/.kubeconfig" ]
config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__exclude: [ "contrib/vagrant/.kubectl", "contrib/vagrant/.kubeconfig" ]
end

config.vm.provision "shell", inline: <<-SHELL
Expand All @@ -63,7 +63,7 @@ Vagrant.configure(2) do |config|
set -xe
export WITH_LOCAL_NFS=true
export NETWORK_PROVIDER=#{$network_provider}
cd /vagrant/cluster
cd /vagrant/contrib/vagrant
bash setup_kubernetes_master.sh
set +x
echo -e "\033[0;32m Deployment was successful!"
Expand All @@ -83,7 +83,7 @@ Vagrant.configure(2) do |config|
node.vm.provision "shell", inline: <<-SHELL
#!/bin/bash
set -xe
cd /vagrant/cluster
cd /vagrant/contrib/vagrant
bash setup_kubernetes_node.sh
set +x
echo -e "\033[0;32m Deployment was successful!\033[0m"
Expand Down
17 changes: 0 additions & 17 deletions cluster/kubectl.sh

This file was deleted.

File renamed without changes.
17 changes: 17 additions & 0 deletions contrib/vagrant/kubectl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

source hack/config.sh

if [ "x$1" == "x--init" ]
then
exec contrib/vagrant/sync_config.sh
fi

if [ -e contrib/vagrant/.kubeconfig ] && [ -e contrib/vagrant/.kubectl ] && [ "x$1" == "x--core" ];then
shift
contrib/vagrant/.kubectl --kubeconfig=contrib/vagrant/.kubeconfig $@
elif [ -e contrib/vagrant/.kubectl ];then
contrib/vagrant/.kubectl -s http://${master_ip}:8184 $@
else
echo "Did you already run './contrib/vagrant/sync.sh' to deploy kubevirt?"
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions cluster/sync_config.sh → contrib/vagrant/sync_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ vagrant ssh-config master 2>&1 | grep "not yet ready for SSH" >/dev/null \

OPTIONS=`vagrant ssh-config master | grep -v '^Host ' | awk -v ORS=' ' 'NF{print "-o " $1 "=" $2}'`

scp $OPTIONS master:/usr/bin/kubectl cluster/.kubectl
chmod u+x cluster/.kubectl
scp $OPTIONS master:/usr/bin/kubectl contrib/vagrant/.kubectl
chmod u+x contrib/vagrant/.kubectl

vagrant ssh master -c "sudo cat /etc/kubernetes/kubelet.conf" > cluster/.kubeconfig
vagrant ssh master -c "sudo cat /etc/kubernetes/kubelet.conf" > contrib/vagrant/.kubeconfig
File renamed without changes.
34 changes: 17 additions & 17 deletions scripts/quickcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ startvm () {
HEADERS="-H \"Content-Type: application/json\""
VM_NAME=$1
TARGET_NODE=$2
DOMAIN="sed -e s/testvm/$VM_NAME/g cluster/vm.json"
DOMAIN="sed -e s/testvm/$VM_NAME/g contrib/vagrant/vm.json"
$DOMAIN | curl -X POST -H "Content-Type: application/json" http://${master_ip}:8183/apis/kubevirt.io/v1alpha1/namespaces/default/vms -d @-
}

Expand Down Expand Up @@ -48,22 +48,22 @@ shift
done

if [ -z "$CLEAN_ALL" ]; then
vagrant ssh master -c "kubectl delete pods -l domain=${VM_NAME}"
vagrant ssh master -c "kubectl delete vms ${VM_NAME}"
set -e
sleep 2
startvm $VM_NAME $TARGET_NODE
sleep 10
NODE=$(vagrant ssh master -c "kubectl -s 127.0.0.1:8080 get pods -o json -l kubevirt.io/domain=${VM_NAME} | jq '.items[].spec.nodeName' -r" | sed -e 's/[[:space:]]*$//')
vagrant ssh master -c "kubectl delete pods -l domain=${VM_NAME}"
vagrant ssh master -c "kubectl delete vms ${VM_NAME}"
set -e
sleep 2
startvm $VM_NAME $TARGET_NODE
sleep 10
NODE=$(vagrant ssh master -c "kubectl -s 127.0.0.1:8080 get pods -o json -l kubevirt.io/domain=${VM_NAME} | jq '.items[].spec.nodeName' -r" | sed -e 's/[[:space:]]*$//')

if [ -z $NODE ]; then
echo "Could not detect the VM."
exit 1
fi
echo "Found VM running on node '$NODE'"
# VM can also spawn on node
vagrant ssh $NODE -c "sudo /vagrant/scripts/verify-qemu-kube ${VM_NAME}"
if [ -z $NODE ]; then
echo "Could not detect the VM."
exit 1
fi
echo "Found VM running on node '$NODE'"
# VM can also spawn on node
vagrant ssh $NODE -c "sudo /vagrant/scripts/verify-qemu-kube ${VM_NAME}"
else
vagrant ssh master -c "kubectl delete pods -l kubevirt.io/app=virt-launcher"
vagrant ssh master -c "kubectl delete vms --all"
vagrant ssh master -c "kubectl delete pods -l kubevirt.io/app=virt-launcher"
vagrant ssh master -c "kubectl delete vms --all"
fi
6 changes: 3 additions & 3 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -ex

cluster/sync_config.sh
contrib/vagrant/sync_config.sh

make all

Expand All @@ -13,9 +13,9 @@ done
# Deploy all manifests files
set +x
for i in `ls cluster/manifest/*.yaml`; do
cluster/kubectl.sh --core delete -f $i --grace-period 0 2>/dev/null || :
contrib/vagrant/kubectl.sh --core delete -f $i --grace-period 0 2>/dev/null || :
done
sleep 2
for i in `ls cluster/manifest/*.yaml`; do
cluster/kubectl.sh --core create -f $i
contrib/vagrant/kubectl.sh --core create -f $i
done

0 comments on commit 0b084e3

Please sign in to comment.