summaryrefslogtreecommitdiffstats
path: root/src/vagrant
diff options
context:
space:
mode:
Diffstat (limited to 'src/vagrant')
-rw-r--r--src/vagrant/kubeadm_onap/Vagrantfile23
-rwxr-xr-xsrc/vagrant/kubeadm_onap/host_setup.sh15
-rwxr-xr-xsrc/vagrant/kubeadm_onap/master_setup.sh31
-rwxr-xr-xsrc/vagrant/kubeadm_onap/onap_setup.sh53
-rw-r--r--src/vagrant/kubeadm_onap/registry_setup.sh30
-rw-r--r--src/vagrant/kubeadm_onap/setup_swap.sh5
-rw-r--r--src/vagrant/kubeadm_onap/setup_tunnel.sh3
-rwxr-xr-xsrc/vagrant/kubeadm_onap/worker_setup.sh18
8 files changed, 102 insertions, 76 deletions
diff --git a/src/vagrant/kubeadm_onap/Vagrantfile b/src/vagrant/kubeadm_onap/Vagrantfile
index fe24252..699f607 100644
--- a/src/vagrant/kubeadm_onap/Vagrantfile
+++ b/src/vagrant/kubeadm_onap/Vagrantfile
@@ -1,17 +1,17 @@
-$num_workers=1
+$num_workers=4
Vagrant.require_version ">= 1.8.6"
Vagrant.configure("2") do |config|
- config.vm.box = "yk0/ubuntu-xenial"
- config.vm.provision "shell", path: "host_setup.sh", privileged: false
+ config.vm.box = "ceph/ubuntu-xenial"
config.vm.define "master" do |config|
config.vm.hostname = "master"
+ config.vm.provision "shell", path: "host_setup.sh", privileged: false
config.vm.provision "shell", path: "master_setup.sh", privileged: false
config.vm.network :private_network, ip: "192.168.0.10"
config.vm.provider :libvirt do |libvirt|
- libvirt.memory = 4096
+ libvirt.memory = 8192
libvirt.cpus = 4
end
end
@@ -19,23 +19,14 @@ Vagrant.configure("2") do |config|
(1 .. $num_workers).each do |i|
config.vm.define vm_name = "worker%d" % [i] do |config|
config.vm.hostname = vm_name
+ config.vm.provision "shell", path: "host_setup.sh", privileged: false
config.vm.provision "shell", path: "worker_setup.sh", privileged: false
config.vm.network :private_network, ip: "192.168.0.#{i+20}"
config.vm.provider :libvirt do |libvirt|
- libvirt.memory = 81920
- libvirt.cpus = 32
+ libvirt.memory = 40960
+ libvirt.cpus = 16
end
end
end
- config.vm.define "onap" do |config|
- config.vm.hostname = "onap"
- config.vm.provision "shell", path: "onap_setup.sh", privileged: false
- config.vm.network :private_network, ip: "192.168.0.5"
- config.vm.provider :libvirt do |libvirt|
- libvirt.memory = 2048
- libvirt.cpus = 1
- end
- end
-
end
diff --git a/src/vagrant/kubeadm_onap/host_setup.sh b/src/vagrant/kubeadm_onap/host_setup.sh
index 64e1733..9cfd266 100755
--- a/src/vagrant/kubeadm_onap/host_setup.sh
+++ b/src/vagrant/kubeadm_onap/host_setup.sh
@@ -4,13 +4,15 @@ set -ex
cat << EOF | sudo tee /etc/hosts
127.0.0.1 localhost
-192.168.0.5 onap
192.168.0.10 master
192.168.0.21 worker1
192.168.0.22 worker2
192.168.0.23 worker3
+192.168.0.24 worker4
EOF
+sudo ifconfig eth1 mtu 1400
+
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D
cat << EOF | sudo tee /etc/apt/sources.list.d/docker.list
@@ -22,18 +24,17 @@ cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
-sudo apt-get install -y --allow-unauthenticated --allow-downgrades docker-engine=1.12.6-0~ubuntu-xenial kubelet=1.7.0-00 kubeadm=1.7.0-00 kubectl=1.7.0-00 kubernetes-cni=0.5.1-00
+sudo apt-get install -y --allow-unauthenticated --allow-downgrades docker-engine=1.12.6-0~ubuntu-xenial kubelet=1.9.1-00 kubeadm=1.9.1-00 kubectl=1.9.1-00 kubernetes-cni=0.6.0-00
-sudo systemctl stop docker
cat << EOF | sudo tee /etc/docker/daemon.json
{
- "storage-driver": "overlay"
+ "insecure-registries" : [ "nexus3.onap.org:10001" ]
}
EOF
sudo systemctl daemon-reload
-sudo systemctl start docker
+sudo systemctl restart docker
-sudo systemctl stop kubelet
-sudo rm -rf /var/lib/kubelet
+sudo swapoff -a
sudo systemctl daemon-reload
+sudo systemctl stop kubelet
sudo systemctl start kubelet
diff --git a/src/vagrant/kubeadm_onap/master_setup.sh b/src/vagrant/kubeadm_onap/master_setup.sh
index fa451a2..8840541 100755
--- a/src/vagrant/kubeadm_onap/master_setup.sh
+++ b/src/vagrant/kubeadm_onap/master_setup.sh
@@ -1,13 +1,28 @@
#!/bin/bash
-
set -ex
-sudo kubeadm init --apiserver-advertise-address=192.168.0.10 --service-cidr=10.96.0.0/24 --pod-network-cidr=10.32.0.0/12 --token 8c5adc.1cec8dbf339093f0
+sudo apt-get -y install ntp
+cat << EOF | sudo tee /etc/ntp.conf
+server 127.127.1.0
+fudge 127.127.1.0 stratum 10
+EOF
+sudo service ntp restart
+
+sudo apt install nfs-kernel-server -y
+sudo mkdir /dockerdata-nfs
+sudo chmod 777 /dockerdata-nfs
+cat << EOF | sudo tee /etc/exports
+/dockerdata-nfs *(rw,sync,no_subtree_check,no_root_squash)
+EOF
+sudo systemctl restart nfs-kernel-server.service
+
+sudo kubeadm init --apiserver-advertise-address=192.168.0.10 --service-cidr=10.96.0.0/16 --pod-network-cidr=10.244.0.0/16 --token 8c5adc.1cec8dbf339093f0
mkdir ~/.kube
-sudo cp /etc/kubernetes/admin.conf ~/.kube/config
-sudo chown $(id -u):$(id -g) ~/.kube/config
+sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config
+sudo chown $(id -u):$(id -g) $HOME/.kube/config
+
+wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
+sed -i "s/kube-subnet-mgr/kube-subnet-mgr\n - --iface=eth1/" kube-flannel.yml
+kubectl apply -f kube-flannel.yml
-kubectl apply -f http://git.io/weave-kube-1.6
-curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
-helm init
-kubectl create clusterrolebinding --user system:serviceaccount:kube-system:default kube-system-cluster-admin --clusterrole cluster-admin
+/vagrant/onap_setup.sh
diff --git a/src/vagrant/kubeadm_onap/onap_setup.sh b/src/vagrant/kubeadm_onap/onap_setup.sh
index 4dfe1e1..e4edd8f 100755
--- a/src/vagrant/kubeadm_onap/onap_setup.sh
+++ b/src/vagrant/kubeadm_onap/onap_setup.sh
@@ -2,42 +2,19 @@
set -ex
-sudo apt-get install -y putty-tools python-openstackclient
-mkdir ~/.kube
-r=0
-while [ "$r" == "0" ]
-do
- sleep 30
- echo "y\n" | plink -ssh -pw vagrant vagrant@master "cat ~/.kube/config" > ~/.kube/config || true
- r=$(kubectl get pods -n kube-system | grep "tiller-deploy.*Run" | wc -l)
-done
+kubectl create clusterrolebinding --user system:serviceaccount:kube-system:default kube-system-cluster-admin --clusterrole cluster-admin
+wget https://storage.googleapis.com/kubernetes-helm/helm-v2.8.2-linux-amd64.tar.gz
+tar xzvf helm-v2.8.2-linux-amd64.tar.gz
+sudo mv linux-amd64/helm /usr/local/bin/
+helm init
+helm serve &
+helm repo remove stable
+helm repo add local http://127.0.0.1:8879
-curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
-git clone http://gerrit.onap.org/r/oom
-cd oom; git checkout amsterdam
-source /vagrant/openstack/openrc
-cat <<EOF | tee ~/oom/kubernetes/config/onap-parameters.yaml
-OPENSTACK_UBUNTU_14_IMAGE: "ubuntu1404"
-OPENSTACK_PUBLIC_NET_ID: "e8f51956-00dd-4425-af36-045716781ffc"
-OPENSTACK_OAM_NETWORK_ID: "d4769dfb-c9e4-4f72-b3d6-1d18f4ac4ee6"
-OPENSTACK_OAM_SUBNET_ID: "191f7580-acf6-4c2b-8ec0-ba7d99b3bc4e"
-OPENSTACK_OAM_NETWORK_CIDR: "10.0.0.0/16"
-OPENSTACK_USERNAME: "admin"
-OPENSTACK_API_KEY: "adim"
-OPENSTACK_TENANT_NAME: "admin"
-OPENSTACK_TENANT_ID: "47899782ed714295b1151681fdfd51f5"
-OPENSTACK_REGION: "RegionOne"
-OPENSTACK_KEYSTONE_URL: "http://192.168.0.30:5000/v2.0"
-OPENSTACK_FLAVOUR_MEDIUM: "m1.medium"
-OPENSTACK_SERVICE_TENANT_NAME: "service"
-DMAAP_TOPIC: "AUTO"
-DEMO_ARTIFACTS_VERSION: "1.1.0-SNAPSHOT"
-EOF
-cd ~/oom/kubernetes/oneclick && ./deleteAll.bash -n onap || true
-(kubectl delete ns onap; helm del --purge onap-config) || true
-echo "y\n" | plink -ssh -pw vagrant vagrant@worker1 "sudo rm -rf /dockerdata-nfs/onap"
-cd ~/oom/kubernetes/config && ./createConfig.sh -n onap
-while true; do sleep 30; kubectl get pods --all-namespaces | grep onap | wc -l | grep "^0$" && break; done
-source ~/oom/kubernetes/oneclick/setenv.bash
-sed -i "s/aaiServiceClusterIp:.*/aaiServiceClusterIp: 10.96.0.254/" ~/oom/kubernetes/aai/values.yaml
-cd ~/oom/kubernetes/oneclick && ./createAll.bash -n onap
+git clone -b beijing http://gerrit.onap.org/r/oom
+cd oom/kubernetes
+
+sudo apt-get install make -y
+make all
+sleep 300
+helm install local/onap -n dev --namespace onap
diff --git a/src/vagrant/kubeadm_onap/registry_setup.sh b/src/vagrant/kubeadm_onap/registry_setup.sh
new file mode 100644
index 0000000..669268b
--- /dev/null
+++ b/src/vagrant/kubeadm_onap/registry_setup.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -ex
+
+sudo apt-get update -y
+sudo apt install -y jq docker.io
+
+NEXUS_REPO=nexus3.onap.org:10001
+LOCAL_REPO=192.168.0.2:5000
+
+cat << EOF | sudo tee /etc/docker/daemon.json
+{
+ "insecure-registries" : [ "$LOCAL_REPO" ]
+}
+EOF
+sudo systemctl daemon-reload
+sudo systemctl restart docker
+
+sudo docker run -d -p 5000:5000 --restart=always --name registry registry:2
+
+dockers=$(curl -X GET https://$NEXUS_REPO/v2/_catalog | jq -r ".repositories[]")
+for d in $dockers
+do
+ tags=$(curl -X GET https://$NEXUS_REPO/v2/$d/tags/list | jq -r ".tags[]")
+ for t in $tags
+ do
+ sudo docker pull $NEXUS_REPO/$d:$t
+ sudo docker tag $NEXUS_REPO/$d:$t $LOCAL_REPO/$d:$t
+ sudo docker push $LOCAL_REPO/$d:$t
+ done
+done
diff --git a/src/vagrant/kubeadm_onap/setup_swap.sh b/src/vagrant/kubeadm_onap/setup_swap.sh
new file mode 100644
index 0000000..c2432b7
--- /dev/null
+++ b/src/vagrant/kubeadm_onap/setup_swap.sh
@@ -0,0 +1,5 @@
+sudo swapoff -a
+sudo fallocate -l 50G /swapfile
+sudo mkswap /swapfile
+sudo swapon /swapfile
+sudo swapon --show
diff --git a/src/vagrant/kubeadm_onap/setup_tunnel.sh b/src/vagrant/kubeadm_onap/setup_tunnel.sh
new file mode 100644
index 0000000..3a6ef75
--- /dev/null
+++ b/src/vagrant/kubeadm_onap/setup_tunnel.sh
@@ -0,0 +1,3 @@
+sudo ip link add tunnel0 type gretap local <local> remote <remote>
+sudo ifconfig tunnel0 up
+sudo brctl addif <br> tunnel0
diff --git a/src/vagrant/kubeadm_onap/worker_setup.sh b/src/vagrant/kubeadm_onap/worker_setup.sh
index aa60df3..e65a65c 100755
--- a/src/vagrant/kubeadm_onap/worker_setup.sh
+++ b/src/vagrant/kubeadm_onap/worker_setup.sh
@@ -1,11 +1,15 @@
#!/bin/bash
-
set -ex
-sudo mkdir /dockerdata-nfs
-sudo chmod 755 /dockerdata-nfs
-sudo kubeadm join --token 8c5adc.1cec8dbf339093f0 192.168.0.10:6443 || true
+sudo apt-get -y install ntp
+cat << EOF | sudo tee /etc/ntp.conf
+pool master
+EOF
+sudo service ntp restart
-sudo apt-get install -y putty-tools
-mkdir ~/.kube
-echo "y\n" | plink -ssh -pw vagrant vagrant@master "cat ~/.kube/config" > ~/.kube/config
+sudo kubeadm join --discovery-token-unsafe-skip-ca-verification --token 8c5adc.1cec8dbf339093f0 192.168.0.10:6443 || true
+
+sudo apt-get install nfs-common -y
+sudo mkdir /dockerdata-nfs
+sudo chmod 777 /dockerdata-nfs
+sudo mount master:/dockerdata-nfs /dockerdata-nfs