diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-12-21 04:17:48 -0500 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-12-21 04:46:35 -0500 |
commit | 09c951502f43c477d48903bc335905b2d5287295 (patch) | |
tree | 9cdc3180d96ea25bfb6cffd08e6b0ddc5c5f2184 /src/vagrant/kubeadm_onap/openstack | |
parent | 35951994a9a6eafd94e59958b0c97d80a8660742 (diff) |
onap deployment by kubeadm + onap oom
Change-Id: I4db577c754a4cd550482e40c2a96004faf65bd24
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/vagrant/kubeadm_onap/openstack')
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/Vagrantfile | 37 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/bootstrap.sh | 14 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/compute.conf | 20 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/control.conf | 40 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/create_vm.sh | 5 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/openrc | 4 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/setup_cell.sh | 6 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/setup_compute.sh | 19 | ||||
-rw-r--r-- | src/vagrant/kubeadm_onap/openstack/setup_control.sh | 40 |
9 files changed, 185 insertions, 0 deletions
diff --git a/src/vagrant/kubeadm_onap/openstack/Vagrantfile b/src/vagrant/kubeadm_onap/openstack/Vagrantfile new file mode 100644 index 0000000..f2a806d --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/Vagrantfile @@ -0,0 +1,37 @@ +$num_compute_nodes = 0 + +Vagrant.configure("2") do |config| + + config.vm.box = "yk0/ubuntu-xenial" + + config.vm.provision "shell", path: "bootstrap.sh", privileged: false + + config.vm.define "control" do |config| + config.vm.hostname = "control" + config.vm.network "private_network", ip: "192.168.0.30" + config.vm.network "private_network", ip: "192.168.1.30" + config.vm.provision "shell", path: "setup_control.sh", privileged: false + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 32768 + libvirt.cpus = 8 + libvirt.storage :file, :type => "qcow2", :size => "500G" + libvirt.storage :file, :type => "qcow2", :size => "500G" + end + end + + (1 .. $num_compute_nodes).each do |n| + config.vm.define vm_name = "compute-#{n}" do |config| + config.vm.hostname = vm_name + config.vm.network "private_network", ip: "192.168.0.#{n+40}" + config.vm.network "private_network", ip: "192.168.1.#{n+40}" + config.vm.provision "shell", path: "setup_compute.sh", privileged: false + config.vm.provider :libvirt do |libvirt| + libvirt.memory = 81920 + libvirt.cpus = 32 + libvirt.nested = true + libvirt.storage :file, :type => "qcow2", :size => "500G" + end + end + end + +end diff --git a/src/vagrant/kubeadm_onap/openstack/bootstrap.sh b/src/vagrant/kubeadm_onap/openstack/bootstrap.sh new file mode 100644 index 0000000..9978c81 --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/bootstrap.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -ex + +sudo apt-get update -y +sudo apt-get install git -y +git clone https://github.com/openstack-dev/devstack +cd devstack; git checkout stable/ocata +sudo apt-get install openvswitch-switch -y +sudo ovs-vsctl add-br br-ex +inet=$(ip a | grep 'inet.*eth2' | cut -f6 -d' ') +sudo ip addr flush eth2 +sudo ovs-vsctl add-port br-ex eth2 +sudo ifconfig br-ex $inet up +echo "source /vagrant/openrc" >> $HOME/.bash_profile diff --git a/src/vagrant/kubeadm_onap/openstack/compute.conf b/src/vagrant/kubeadm_onap/openstack/compute.conf new file mode 100644 index 0000000..28b6f4e --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/compute.conf @@ -0,0 +1,20 @@ +[[local|localrc]] +SCREEN_LOGDIR=/opt/stack/log +LOGFILE=stack.sh.log +LOG_COLOR=False + +HOST_IP=HOSTIP +HOST_NAME=HOSTNAME +SERVICE_HOST=192.168.0.30 +SERVICE_HOST_NAME=control + +ADMIN_PASSWORD=admin +SERVICE_PASSWORD=admin +DATABASE_PASSWORD=mysql +RABBIT_PASSWORD=rabbit + +disable_all_services +enable_service rabbit,n-cpu,n-novnc,placement-client,q-agt,n-api-meta + +OVS_BRIDGE_MAPPINGS=public:br-ex +OVS_PHYSICAL_BRIDGE=br-ex diff --git a/src/vagrant/kubeadm_onap/openstack/control.conf b/src/vagrant/kubeadm_onap/openstack/control.conf new file mode 100644 index 0000000..72a3609 --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/control.conf @@ -0,0 +1,40 @@ +[[local|localrc]] +SCREEN_LOGDIR=/opt/stack/log +LOGFILE=stack.sh.log +LOG_COLOR=False + +MULTI_HOST=1 +HOST_IP=192.168.0.30 +HOST_NAME=control +SERVICE_HOST=192.168.0.30 +SERVICE_HOST_NAME=control + +ADMIN_PASSWORD=admin +SERVICE_PASSWORD=admin +DATABASE_PASSWORD=mysql +RABBIT_PASSWORD=rabbit + +enable_plugin heat https://git.openstack.org/openstack/heat stable/ocata +enable_plugin designate https://git.openstack.org/openstack/designate stable/ocata + +disable_all_services +enable_service key,rabbit,mysql +enable_service n-api,n-cond,n-sch,n-novnc,n-crt,n-cauth,placement-api +enable_service q-svc,q-dhcp,q-meta,q-l3,q-agt +enable_service c-sch,c-api,c-vol +enable_service g-api,g-reg +enable_service h-eng,h-api,h-api-cfn,h-api-cw +enable_service horizon +enable_service designate,designate-central,designate-api,designate-pool-manager,designate-zone-manager,designate-mdns +enable_service rabbit,n-cpu,n-novnc,placement-client,q-agt,n-api-meta + +DESIGNATE_BACKEND_DRIVER=bind9 + +## Neutron options +FLOATING_RANGE="192.168.1.0/24" +PUBLIC_NETWORK_GATEWAY="192.168.1.1" +FIXED_RANGE="10.0.0.0/16" +Q_FLOATING_ALLOCATION_POOL=start=192.168.1.200,end=192.168.1.250 +Q_USE_SECGROUP=False +Q_L3_ENABLED=True +Q_USE_PROVIDERNET_FOR_PUBLIC=True diff --git a/src/vagrant/kubeadm_onap/openstack/create_vm.sh b/src/vagrant/kubeadm_onap/openstack/create_vm.sh new file mode 100644 index 0000000..6597ae4 --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/create_vm.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +source ~/devstack/openrc admin admin +netid=$(openstack network list --name private -f value | cut -f1 -d' ') +openstack server create --flavor 1 --image=cirros-0.3.4-x86_64-uec --nic net-id=$netid vm1 diff --git a/src/vagrant/kubeadm_onap/openstack/openrc b/src/vagrant/kubeadm_onap/openstack/openrc new file mode 100644 index 0000000..8e1cd1c --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/openrc @@ -0,0 +1,4 @@ +export OS_PROJECT_NAME=admin +export OS_USERNAME=admin +export OS_PASSWORD=admin +export OS_AUTH_URL=http://192.168.0.30:5000/v2.0 diff --git a/src/vagrant/kubeadm_onap/openstack/setup_cell.sh b/src/vagrant/kubeadm_onap/openstack/setup_cell.sh new file mode 100644 index 0000000..4426501 --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/setup_cell.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -ex + +source ~/devstack/openrc admin admin +nova-manage cell_v2 discover_hosts +nova-manage cell_v2 map_cell_and_hosts diff --git a/src/vagrant/kubeadm_onap/openstack/setup_compute.sh b/src/vagrant/kubeadm_onap/openstack/setup_compute.sh new file mode 100644 index 0000000..92c18cf --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/setup_compute.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -ex + +sudo pvcreate /dev/vdb +sudo vgextend ubuntubox-vg /dev/vdb +sudo lvextend -L+500G /dev/mapper/ubuntubox--vg-root +sudo resize2fs /dev/mapper/ubuntubox--vg-root + +cd devstack +cp /vagrant/compute.conf local.conf +host=$(hostname) +ip=$(ifconfig | grep 192.168.0 | cut -f2 -d: | cut -f1 -d' ') +sed -i -e "s/HOSTIP/$ip/" -e "s/HOSTNAME/$host/" local.conf +./stack.sh + + +sudo apt-get update -y +sudo apt-get install -y putty +echo y | plink -ssh -l vagrant -pw vagrant 192.168.0.30 "bash /vagrant/setup_cell.sh" diff --git a/src/vagrant/kubeadm_onap/openstack/setup_control.sh b/src/vagrant/kubeadm_onap/openstack/setup_control.sh new file mode 100644 index 0000000..1f19a16 --- /dev/null +++ b/src/vagrant/kubeadm_onap/openstack/setup_control.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -ex + +sudo pvcreate /dev/vdb +sudo vgextend ubuntubox-vg /dev/vdb +sudo lvextend -L+500G /dev/mapper/ubuntubox--vg-root +sudo resize2fs /dev/mapper/ubuntubox--vg-root + +cd devstack +cp /vagrant/control.conf local.conf +./stack.sh + +sudo pvcreate /dev/vdc +sudo vgextend stack-volumes-lvmdriver-1 /dev/vdc + +source /vagrant/openrc + +#openstack network create public --external --provider-network-type=flat --provider-physical-network=public +#openstack subnet create --network=public --subnet-range=192.168.1.0/24 --allocation-pool start=192.168.1.200,end=192.168.1.250 --gateway 192.168.1.1 public-subnet +openstack security group list -f value | cut -f1 -d" " | xargs -I {} openstack security group rule create --ingress --ethertype=IPv4 --protocol=0 {} + +wget https://cloud-images.ubuntu.com/releases/14.04.1/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img +wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img +wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 +openstack image create ubuntu1404 --file ubuntu-14.04-server-cloudimg-amd64-disk1.img --disk-format qcow2 +openstack image create ubuntu1604 --file ubuntu-16.04-server-cloudimg-amd64-disk1.img --disk-format qcow2 +openstack image create centos7 --file CentOS-7-x86_64-GenericCloud.qcow2 --disk-format qcow2 + +openstack quota set admin --instances 32 +openstack quota set admin --cores 128 +openstack quota set admin --ram 409600 + +openstack flavor delete m1.medium || true +openstack flavor create --public m1.medium --id auto --ram 4096 --vcpus 2 --disk 40 +openstack flavor delete m1.large || true +openstack flavor create --public m1.large --id auto --ram 8192 --vcpus 2 --disk 40 +openstack flavor delete m1.xlarge || true +openstack flavor create --public m1.xlarge --id auto --ram 12288 --vcpus 4 --disk 40 +openstack flavor delete m1.xxlarge || true +openstack flavor create --public m1.xxlarge --id auto --ram 16384 --vcpus 4 --disk 40 |