From 3b92e8714fc9a2e10cdbd73e36c05c838ba55852 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Wed, 7 Oct 2015 23:18:40 -0700 Subject: Move around the development environments THe top level dev directory is now used to store the heat and vagrant development environments. backport: liberty TrivialFix Change-Id: Ib0922b90eacaa8518aee09cdeb46f4ac0437e015 --- README.rst | 6 +- dev/heat/get-image.sh | 41 ++++++++ dev/heat/kollacluster.yaml | 120 +++++++++++++++++++++ dev/heat/kollanode.yaml | 251 ++++++++++++++++++++++++++++++++++++++++++++ dev/heat/local.yaml.example | 5 + dev/vagrant/Vagrantfile | 168 +++++++++++++++++++++++++++++ dev/vagrant/bootstrap.sh | 154 +++++++++++++++++++++++++++ devenv/get-image.sh | 41 -------- devenv/kollacluster.yaml | 120 --------------------- devenv/kollanode.yaml | 251 -------------------------------------------- devenv/local.yaml.example | 5 - vagrant/Vagrantfile | 168 ----------------------------- vagrant/bootstrap.sh | 154 --------------------------- 13 files changed, 742 insertions(+), 742 deletions(-) create mode 100755 dev/heat/get-image.sh create mode 100644 dev/heat/kollacluster.yaml create mode 100644 dev/heat/kollanode.yaml create mode 100644 dev/heat/local.yaml.example create mode 100644 dev/vagrant/Vagrantfile create mode 100644 dev/vagrant/bootstrap.sh delete mode 100755 devenv/get-image.sh delete mode 100644 devenv/kollacluster.yaml delete mode 100644 devenv/kollanode.yaml delete mode 100644 devenv/local.yaml.example delete mode 100644 vagrant/Vagrantfile delete mode 100644 vagrant/bootstrap.sh diff --git a/README.rst b/README.rst index 5904a24e7..2e581c0a2 100644 --- a/README.rst +++ b/README.rst @@ -70,7 +70,9 @@ Directories community members which want to use Kolla container content without Ansible. - demos - Contains a few demos to use with Kolla. -- devenv - Contains an OpenStack-Heat based development environment. +- dev/heat - Contains an OpenStack-Heat based development environment. +- dev/vagrant - Contains a vagrant VirtualBox/Libvirt based development + environment. - doc - Contains documentation. - etc - Contains a reference etc directory structure which requires configuration of a small number of configuration variables to achieve @@ -80,8 +82,6 @@ Directories - specs - Contains the Kolla communities key arguments about architectural shifts in the code base. - tests - Contains functional testing tools. -- vagrant - Contains a vagrant VirtualBox-based development - environment. Getting Involved ================ diff --git a/dev/heat/get-image.sh b/dev/heat/get-image.sh new file mode 100755 index 000000000..21166301e --- /dev/null +++ b/dev/heat/get-image.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# This script expects the following to be installed: +# curl, libguestfs-tools-c + +IMAGE_URL=http://archive.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64 +IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2 +TARGET_DIR=/var/lib/libvirt/images +TARGET=fedora-21-x86_64 +export LIBGUESTFS_BACKEND=direct + +if ! [ -f "$IMAGE" ]; then + echo "Downloading $IMAGE" + curl -L -O $IMAGE_URL/$IMAGE +fi + +echo "Copying $IMAGE to $TARGET" +cp "$IMAGE" $TARGET_DIR/$TARGET + + +TMPFILE=$(mktemp /tmp/kolla-ifcfg-eth1.XXXXXXXXXX) +cat > $TMPFILE < + This template will boot a Kolla cluster with one or more + nodes (as specified by the number_of_nodes parameter, + which defaults to "1"). + +parameters: + # + # REQUIRED PARAMETERS + # + ssh_key_name: + type: string + description: name of ssh key to be provisioned on the Nova instances + + external_network_id: + type: string + description: uuid of a network to use for aaccessing Kolla hosts by floating ip address + + container_external_network_id: + type: string + description: uuid of a network to use for container floating ip addresses + + container_external_subnet_id: + type: string + description: uuid of a subnet to use for container floating ip addresses + + # + # OPTIONAL PARAMETERS + # + server_image: + type: string + default: fedora-21-x86_64 + description: glance image used to boot the Nova instance + + server_flavor: + type: string + default: m1.small + description: flavor to use when booting the Nova instance + + dns_nameserver: + type: string + description: address of a dns nameserver reachable in your environment + default: 8.8.8.8 + + number_of_nodes: + type: string + description: how many kolla nodes to spawn + default: 1 + + fixed_network_cidr: + type: string + description: network range for fixed ip network + default: 10.0.0.0/24 + +resources: + + ###################################################################### + # + # network resources. allocate a network and router for our server. + # it would also be possible to take advantage of existing network + # resources (and have the deployer provide network and subnet ids, + # etc, as parameters), but I wanted to minmize the amount of + # configuration necessary to make this go. + fixed_network: + type: "OS::Neutron::Net" + + # This is the subnet on which we will deploy our server eth0. + fixed_subnet: + type: "OS::Neutron::Subnet" + properties: + cidr: {get_param: fixed_network_cidr} + network_id: + get_resource: fixed_network + dns_nameservers: + - get_param: dns_nameserver + + # create a router attached to the external network provided as a + # parameter to this stack. + extrouter: + type: "OS::Neutron::Router" + properties: + external_gateway_info: + network: + get_param: external_network_id + + # attached fixed_subnet to our extrouter router. + extrouter_inside: + type: "OS::Neutron::RouterInterface" + properties: + router_id: + get_resource: extrouter + subnet_id: + get_resource: + fixed_subnet + + kolla_nodes: + type: "OS::Heat::ResourceGroup" + depends_on: + - extrouter_inside + properties: + count: {get_param: number_of_nodes} + resource_def: + type: kollanode.yaml + properties: + ssh_key_name: {get_param: ssh_key_name} + server_image: {get_param: server_image} + server_flavor: {get_param: server_flavor} + fixed_network_id: {get_resource: fixed_network} + fixed_subnet_id: {get_resource: fixed_subnet} + external_network_id: {get_param: external_network_id} + container_external_network_id: {get_param: container_external_network_id} + container_external_subnet_id: {get_param: container_external_subnet_id} +outputs: + + kolla_node_internal_ip: + value: {get_attr: [kolla_nodes, kolla_node_ip_eth0]} + + kolla_node_external_ip: + value: {get_attr: [kolla_nodes, kolla_node_external_ip]} diff --git a/dev/heat/kollanode.yaml b/dev/heat/kollanode.yaml new file mode 100644 index 000000000..ce809e4ed --- /dev/null +++ b/dev/heat/kollanode.yaml @@ -0,0 +1,251 @@ +heat_template_version: 2013-05-23 + +description: > + This is a nested stack that defines a single Kolla node, + based on a Fedora 21 cloud image. This stack is included by + a ResourceGroup resource in the parent template (kollacluster.yaml). + +parameters: + + server_image: + type: string + default: fedora-21-x86_64 + description: glance image used to boot the server + + server_flavor: + type: string + default: m1.small + description: flavor to use when booting the server + + ssh_key_name: + type: string + description: name of ssh key to be provisioned on our server + + external_network_id: + type: string + description: uuid of a network to use for kolla host floating ip addresses + + container_external_network_id: + type: string + description: uuid of a network to use for container floating ip addresses + + container_external_subnet_id: + type: string + description: uuid of a subnet to use for container floating ip addresses + + # The following are all generated in the parent template. + fixed_network_id: + type: string + description: Network from which to allocate fixed addresses. + fixed_subnet_id: + type: string + description: Subnet from which to allocate fixed addresses. + +resources: + + node_wait_handle: + type: "AWS::CloudFormation::WaitConditionHandle" + + node_wait_condition: + type: "AWS::CloudFormation::WaitCondition" + depends_on: + - kolla_node + properties: + Handle: + get_resource: node_wait_handle + Timeout: "6000" + + ###################################################################### + # + # security groups. we need to permit network traffic of various + # sorts. + # + secgroup_base: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: icmp + - protocol: tcp + port_range_min: 22 + port_range_max: 22 + + # Use by eth1 to permit all traffic to instances. + # Let the Neutron container apply security to this traffic. + secgroup_all_open: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: icmp + - protocol: tcp + - protocol: udp + + secgroup_kolla: + type: "OS::Neutron::SecurityGroup" + properties: + rules: + - protocol: tcp + port_range_min: 5672 + port_range_max: 5672 + - protocol: tcp + port_range_min: 3306 + port_range_max: 3306 + - protocol: tcp + port_range_min: 8773 + port_range_max: 8776 + - protocol: tcp + port_range_min: 6080 + port_range_max: 6080 + - protocol: tcp + port_range_min: 6081 + port_range_max: 6081 + - protocol: tcp + port_range_min: 35357 + port_range_max: 35357 + - protocol: tcp + port_range_min: 5000 + port_range_max: 5000 + - protocol: tcp + port_range_min: 9191 + port_range_max: 9191 + - protocol: tcp + port_range_min: 9292 + port_range_max: 9292 + - protocol: tcp + port_range_min: 9696 + port_range_max: 9696 + - protocol: tcp + port_range_min: 80 + port_range_max: 80 + - protocol: tcp + port_range_min: 443 + port_range_max: 443 + - protocol: tcp + port_range_min: 8000 + port_range_max: 8000 + - protocol: tcp + port_range_min: 8004 + port_range_max: 8004 + - protocol: tcp + port_range_min: 8003 + port_range_max: 8003 + - protocol: tcp + port_range_min: 8080 + port_range_max: 8080 + - protocol: tcp + port_range_min: 8777 + port_range_max: 8777 + + kolla_node: + type: "OS::Nova::Server" + properties: + image: + get_param: server_image + flavor: + get_param: server_flavor + key_name: + get_param: ssh_key_name + user_data_format: RAW + user_data: + str_replace: + template: | + #!/bin/bash + + # Latest packages + yum clean all + yum -y update + + # Remove network manager + yum -y remove NetworkManager + chkconfig network on + + # Install base packages + yum -y install wget ntp git tcpdump python-pip python-devel + + # Install Docker from binaries + curl -L https://get.docker.com/builds/Linux/x86_64/docker-1.7.0 -o /usr/local/sbin/docker + chmod +x /usr/local/sbin/docker && cd /usr/local/sbin/ + ./docker -d & + + # Install Compose with pid=host support + cd /root + git clone http://github.com/docker/compose.git + cd compose + pip install -e . + + # Pull the Kolla repo + cd /root + git clone https://github.com/openstack/kolla.git + + # Add vxlan kernel module for Neutron + modprobe vxlan + + # Start NTP + systemctl enable ntpd + systemctl start ntpd + + # Install mariadb-client + yum install -y mariadb + + # Install OpenStack Clients + yum install -y python-keystoneclient python-glanceclient \ + python-novaclient python-cinderclient \ + python-neutronclient python-heatclient + + # Disable firewalld per OpenStack documentation + service firewalld stop + chkconfig firewalld off + + # Install Magnum Client + git clone http://github.com/openstack/python-magnumclient + cd python-magnumclient + sudo pip install -e . + + # Send the CFN signal + cfn-signal -e0 --data 'OK' -r 'Setup complete' '$WAIT_HANDLE' + params: + "$WAIT_HANDLE": + get_resource: node_wait_handle + networks: + - port: + get_resource: kolla_node_eth0 + - port: + get_resource: kolla_node_eth1 + + kolla_node_eth0: + type: "OS::Neutron::Port" + properties: + network_id: + get_param: fixed_network_id + security_groups: + - get_resource: secgroup_base + - get_resource: secgroup_kolla + fixed_ips: + - subnet_id: + get_param: fixed_subnet_id + + kolla_node_eth1: + type: "OS::Neutron::Port" + properties: + network_id: + get_param: container_external_network_id + security_groups: + - get_resource: secgroup_all_open + fixed_ips: + - subnet_id: + get_param: container_external_subnet_id + + kolla_node_floating: + type: "OS::Neutron::FloatingIP" + properties: + floating_network_id: + get_param: external_network_id + port_id: + get_resource: kolla_node_eth0 + +outputs: + + kolla_node_ip_eth0: + value: {get_attr: [kolla_node_eth0, fixed_ips, 0, ip_address]} + + kolla_node_external_ip: + value: {get_attr: [kolla_node_floating, floating_ip_address]} diff --git a/dev/heat/local.yaml.example b/dev/heat/local.yaml.example new file mode 100644 index 000000000..8f76cd835 --- /dev/null +++ b/dev/heat/local.yaml.example @@ -0,0 +1,5 @@ +parameters: + ssh_key_name: + external_network_id: + container_external_network_id: + container_external_subnet_id: diff --git a/dev/vagrant/Vagrantfile b/dev/vagrant/Vagrantfile new file mode 100644 index 000000000..c2c1d7f68 --- /dev/null +++ b/dev/vagrant/Vagrantfile @@ -0,0 +1,168 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +require "ipaddr" + +# Either libvirt or virtualbox +PROVIDER = "libvirt" + +PROVIDER_DEFAULTS = { + libvirt: { + base_image: "centos/7", + bridge_interface: "virbr0", + vagrant_shared_folder: "/home/vagrant/sync", + sync_method: "nfs", + }, + virtualbox: { + base_image: "puppetlabs/centos-7.0-64-puppet", + bridge_interface: "wlp3s0b1", + vagrant_shared_folder: "/vagrant", + sync_method: "virtualbox", + }, +} + +# Whether to do Multi-node or All-in-One deployment +MULTINODE=false + +# The following is only used when deploying in Multi-nodes +NUMBER_OF_CONTROL_NODES=3 +NUMBER_OF_COMPUTE_NODES=1 +NUMBER_OF_STORAGE_NODES=1 +NUMBER_OF_NETWORK_NODES=1 + +# Configure a new SSH key and config so the operator is able to connect with +# the other cluster nodes. +unless File.file?("./vagrantkey") + system("ssh-keygen -f ./vagrantkey -N '' -C this-is-vagrant") +end + +def get_default(setting) + PROVIDER_DEFAULTS[PROVIDER.to_sym][setting] +end + +Vagrant.configure(2) do |config| + config.vm.box = get_default(:base_image) + + # Next to the hostonly NAT-network there is a host-only network with all + # nodes attached. Plus, each node receives a 3rd adapter connected to the + # outside public network. + config.vm.network "private_network", type: "dhcp" + config.vm.network "public_network", dev: get_default(:bridge_interface), mode: 'bridge', type: 'bridge' + + my_privatekey = File.read(File.join(File.dirname(__FILE__), "vagrantkey")) + my_publickey = File.read(File.join(File.dirname(__FILE__), "vagrantkey.pub")) + + config.vm.provision :shell, inline: <<-EOS + mkdir -p /root/.ssh + echo '#{my_privatekey}' > /root/.ssh/id_rsa + chmod 600 /root/.ssh/id_rsa + echo '#{my_publickey}' > /root/.ssh/authorized_keys + chmod 600 /root/.ssh/authorized_keys + echo '#{my_publickey}' > /root/.ssh/id_rsa.pub + chmod 644 /root/.ssh/id_rsa.pub + mkdir -p /home/vagrant/.ssh + echo '#{my_privatekey}' >> /home/vagrant/.ssh/id_rsa + chmod 600 /home/vagrant/.ssh/* + echo 'Host *' > ~vagrant/.ssh/config + echo StrictHostKeyChecking no >> ~vagrant/.ssh/config + chown -R vagrant: /home/vagrant/.ssh + EOS + + config.hostmanager.enabled = true + # Make sure hostmanager picks IP address of eth1 + config.hostmanager.ip_resolver = proc do |vm, resolving_vm| + case PROVIDER + when "libvirt" + if vm.name + `virsh -c qemu:///system net-dhcp-leases vagrant-private-dhcp | awk -F'[ /]+' '/#{vm.name} / {print $6}'`.chop + end + when "virtualbox" + if vm.id + `VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP"`.split()[1] + end + end + end + + # The operator controls the deployment + config.vm.define "operator" do |admin| + admin.vm.hostname = "operator.local" + admin.vm.provision :shell, path: "bootstrap.sh", args: "operator #{MULTINODE ? 'multinode' : 'aio'}" + admin.vm.synced_folder "..", "/home/vagrant/kolla", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder "storage/operator/", "/data/host", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + admin.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + admin.vm.provider PROVIDER do |vm| + vm.memory = MULTINODE ? 1024 : 4096 + if PROVIDER == 'libvirt' + # This only works with libvirt provider. + # We should be able to do something similar for virtualbox + # http://askubuntu.com/questions/317338/how-can-i-increase-disk-size-on-a-vagrant-vm + vm.machine_virtual_size = 40 + end + end + admin.hostmanager.aliases = "operator" + end + + if MULTINODE + # Build compute nodes + (1..NUMBER_OF_COMPUTE_NODES).each do |i| + config.vm.define "compute0#{i}" do |compute| + compute.vm.hostname = "compute0#{i}.local" + compute.vm.provision :shell, path: "bootstrap.sh" + compute.vm.synced_folder "storage/compute/", "/data/host", create:"True", type: get_default(:sync_method) + compute.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + compute.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + compute.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + compute.hostmanager.aliases = "compute0#{i}" + end + end + + # Build storage nodes + (1..NUMBER_OF_STORAGE_NODES).each do |i| + config.vm.define "storage0#{i}" do |storage| + storage.vm.hostname = "storage0#{i}.local" + storage.vm.provision :shell, path: "bootstrap.sh" + storage.vm.synced_folder "storage/storage/", "/data/host", create:"True", type: get_default(:sync_method) + storage.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + storage.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + storage.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + storage.hostmanager.aliases = "storage0#{i}" + end + end + + # Build network nodes + (1..NUMBER_OF_NETWORK_NODES).each do |i| + config.vm.define "network0#{i}" do |network| + network.vm.hostname = "network0#{i}.local" + network.vm.provision :shell, path: "bootstrap.sh" + network.vm.synced_folder "storage/network/", "/data/host", create:"True", type: get_default(:sync_method) + network.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + network.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + network.vm.provider PROVIDER do |vm| + vm.memory = 1024 + end + network.hostmanager.aliases = "network0#{i}" + end + end + + # Build control nodes + (1..NUMBER_OF_CONTROL_NODES).each do |i| + config.vm.define "control0#{i}" do |control| + control.vm.hostname = "control0#{i}.local" + control.vm.provision :shell, path: "bootstrap.sh" + control.vm.synced_folder "storage/control/", "/data/host", create:"True", type: get_default(:sync_method) + control.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) + control.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true + control.vm.provider PROVIDER do |vm| + vm.memory = 2048 + end + control.hostmanager.aliases = "control0#{i}" + end + end + end + +end diff --git a/dev/vagrant/bootstrap.sh b/dev/vagrant/bootstrap.sh new file mode 100644 index 000000000..889942922 --- /dev/null +++ b/dev/vagrant/bootstrap.sh @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# +# Bootstrap script to configure all nodes. +# + +export http_proxy= +export https_proxy= + +if [ $2 = 'aio' ]; then + # Run registry on port 4000 since it may collide with keystone when doing AIO + REGISTRY_PORT=4000 + SUPPORT_NODE=operator +else + REGISTRY_PORT=5000 + SUPPORT_NODE=support01 +fi +REGISTRY=operator.local:${REGISTRY_PORT} + +# Install common packages and do some prepwork. +function prep_work { + systemctl stop firewalld + systemctl disable firewalld + + # This removes the fqdn from /etc/hosts's 127.0.0.1. This name.local will + # resolve to the public IP instead of localhost. + sed -i -r "s/^(127\.0\.0\.1\s+)(.*) `hostname` (.+)/\1 \3/" /etc/hosts + + yum install -y http://mirror.nl.leaseweb.net/epel/7/x86_64/e/epel-release-7-5.noarch.rpm + yum install -y MySQL-python vim-enhanced python-pip python-devel gcc openssl-devel libffi-devel libxml2-devel libxslt-devel && yum clean all + pip install --upgrade docker-py +} + +# Install and configure a quick&dirty docker daemon. +function install_docker { + # Allow for an externally supplied docker binary. + if [ -f "/data/docker" ]; then + cp /vagrant/docker /usr/bin/docker + chmod +x /usr/bin/docker + else + cat >/etc/yum.repos.d/docker.repo <<-EOF +[dockerrepo] +name=Docker Repository +baseurl=https://yum.dockerproject.org/repo/main/centos/7 +enabled=1 +gpgcheck=1 +gpgkey=https://yum.dockerproject.org/gpg +EOF + # Also upgrade device-mapper here because of: + # https://github.com/docker/docker/issues/12108 + yum install -y docker-engine device-mapper + + # Despite it shipping with /etc/sysconfig/docker, Docker is not configured to + # load it from it's service file. + sed -i -r "s,(ExecStart)=(.+),\1=/usr/bin/docker -d --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}," /usr/lib/systemd/system/docker.service + + systemctl daemon-reload + systemctl enable docker + systemctl start docker + fi + + usermod -aG docker vagrant +} + +function resize_partition { + fdisk /dev/vda < ~/kolla/.buildconf" + fi + + cp -r ~vagrant/kolla/etc/kolla/ /etc/kolla + mkdir -p /usr/share/kolla + chown -R vagrant: /etc/kolla /usr/share/kolla + + configure_kolla + + # Make sure Ansible uses scp. + cat > ~vagrant/.ansible.cfg < ~vagrant/openrc < $TMPFILE < - This template will boot a Kolla cluster with one or more - nodes (as specified by the number_of_nodes parameter, - which defaults to "1"). - -parameters: - # - # REQUIRED PARAMETERS - # - ssh_key_name: - type: string - description: name of ssh key to be provisioned on the Nova instances - - external_network_id: - type: string - description: uuid of a network to use for aaccessing Kolla hosts by floating ip address - - container_external_network_id: - type: string - description: uuid of a network to use for container floating ip addresses - - container_external_subnet_id: - type: string - description: uuid of a subnet to use for container floating ip addresses - - # - # OPTIONAL PARAMETERS - # - server_image: - type: string - default: fedora-21-x86_64 - description: glance image used to boot the Nova instance - - server_flavor: - type: string - default: m1.small - description: flavor to use when booting the Nova instance - - dns_nameserver: - type: string - description: address of a dns nameserver reachable in your environment - default: 8.8.8.8 - - number_of_nodes: - type: string - description: how many kolla nodes to spawn - default: 1 - - fixed_network_cidr: - type: string - description: network range for fixed ip network - default: 10.0.0.0/24 - -resources: - - ###################################################################### - # - # network resources. allocate a network and router for our server. - # it would also be possible to take advantage of existing network - # resources (and have the deployer provide network and subnet ids, - # etc, as parameters), but I wanted to minmize the amount of - # configuration necessary to make this go. - fixed_network: - type: "OS::Neutron::Net" - - # This is the subnet on which we will deploy our server eth0. - fixed_subnet: - type: "OS::Neutron::Subnet" - properties: - cidr: {get_param: fixed_network_cidr} - network_id: - get_resource: fixed_network - dns_nameservers: - - get_param: dns_nameserver - - # create a router attached to the external network provided as a - # parameter to this stack. - extrouter: - type: "OS::Neutron::Router" - properties: - external_gateway_info: - network: - get_param: external_network_id - - # attached fixed_subnet to our extrouter router. - extrouter_inside: - type: "OS::Neutron::RouterInterface" - properties: - router_id: - get_resource: extrouter - subnet_id: - get_resource: - fixed_subnet - - kolla_nodes: - type: "OS::Heat::ResourceGroup" - depends_on: - - extrouter_inside - properties: - count: {get_param: number_of_nodes} - resource_def: - type: kollanode.yaml - properties: - ssh_key_name: {get_param: ssh_key_name} - server_image: {get_param: server_image} - server_flavor: {get_param: server_flavor} - fixed_network_id: {get_resource: fixed_network} - fixed_subnet_id: {get_resource: fixed_subnet} - external_network_id: {get_param: external_network_id} - container_external_network_id: {get_param: container_external_network_id} - container_external_subnet_id: {get_param: container_external_subnet_id} -outputs: - - kolla_node_internal_ip: - value: {get_attr: [kolla_nodes, kolla_node_ip_eth0]} - - kolla_node_external_ip: - value: {get_attr: [kolla_nodes, kolla_node_external_ip]} diff --git a/devenv/kollanode.yaml b/devenv/kollanode.yaml deleted file mode 100644 index ce809e4ed..000000000 --- a/devenv/kollanode.yaml +++ /dev/null @@ -1,251 +0,0 @@ -heat_template_version: 2013-05-23 - -description: > - This is a nested stack that defines a single Kolla node, - based on a Fedora 21 cloud image. This stack is included by - a ResourceGroup resource in the parent template (kollacluster.yaml). - -parameters: - - server_image: - type: string - default: fedora-21-x86_64 - description: glance image used to boot the server - - server_flavor: - type: string - default: m1.small - description: flavor to use when booting the server - - ssh_key_name: - type: string - description: name of ssh key to be provisioned on our server - - external_network_id: - type: string - description: uuid of a network to use for kolla host floating ip addresses - - container_external_network_id: - type: string - description: uuid of a network to use for container floating ip addresses - - container_external_subnet_id: - type: string - description: uuid of a subnet to use for container floating ip addresses - - # The following are all generated in the parent template. - fixed_network_id: - type: string - description: Network from which to allocate fixed addresses. - fixed_subnet_id: - type: string - description: Subnet from which to allocate fixed addresses. - -resources: - - node_wait_handle: - type: "AWS::CloudFormation::WaitConditionHandle" - - node_wait_condition: - type: "AWS::CloudFormation::WaitCondition" - depends_on: - - kolla_node - properties: - Handle: - get_resource: node_wait_handle - Timeout: "6000" - - ###################################################################### - # - # security groups. we need to permit network traffic of various - # sorts. - # - secgroup_base: - type: "OS::Neutron::SecurityGroup" - properties: - rules: - - protocol: icmp - - protocol: tcp - port_range_min: 22 - port_range_max: 22 - - # Use by eth1 to permit all traffic to instances. - # Let the Neutron container apply security to this traffic. - secgroup_all_open: - type: "OS::Neutron::SecurityGroup" - properties: - rules: - - protocol: icmp - - protocol: tcp - - protocol: udp - - secgroup_kolla: - type: "OS::Neutron::SecurityGroup" - properties: - rules: - - protocol: tcp - port_range_min: 5672 - port_range_max: 5672 - - protocol: tcp - port_range_min: 3306 - port_range_max: 3306 - - protocol: tcp - port_range_min: 8773 - port_range_max: 8776 - - protocol: tcp - port_range_min: 6080 - port_range_max: 6080 - - protocol: tcp - port_range_min: 6081 - port_range_max: 6081 - - protocol: tcp - port_range_min: 35357 - port_range_max: 35357 - - protocol: tcp - port_range_min: 5000 - port_range_max: 5000 - - protocol: tcp - port_range_min: 9191 - port_range_max: 9191 - - protocol: tcp - port_range_min: 9292 - port_range_max: 9292 - - protocol: tcp - port_range_min: 9696 - port_range_max: 9696 - - protocol: tcp - port_range_min: 80 - port_range_max: 80 - - protocol: tcp - port_range_min: 443 - port_range_max: 443 - - protocol: tcp - port_range_min: 8000 - port_range_max: 8000 - - protocol: tcp - port_range_min: 8004 - port_range_max: 8004 - - protocol: tcp - port_range_min: 8003 - port_range_max: 8003 - - protocol: tcp - port_range_min: 8080 - port_range_max: 8080 - - protocol: tcp - port_range_min: 8777 - port_range_max: 8777 - - kolla_node: - type: "OS::Nova::Server" - properties: - image: - get_param: server_image - flavor: - get_param: server_flavor - key_name: - get_param: ssh_key_name - user_data_format: RAW - user_data: - str_replace: - template: | - #!/bin/bash - - # Latest packages - yum clean all - yum -y update - - # Remove network manager - yum -y remove NetworkManager - chkconfig network on - - # Install base packages - yum -y install wget ntp git tcpdump python-pip python-devel - - # Install Docker from binaries - curl -L https://get.docker.com/builds/Linux/x86_64/docker-1.7.0 -o /usr/local/sbin/docker - chmod +x /usr/local/sbin/docker && cd /usr/local/sbin/ - ./docker -d & - - # Install Compose with pid=host support - cd /root - git clone http://github.com/docker/compose.git - cd compose - pip install -e . - - # Pull the Kolla repo - cd /root - git clone https://github.com/openstack/kolla.git - - # Add vxlan kernel module for Neutron - modprobe vxlan - - # Start NTP - systemctl enable ntpd - systemctl start ntpd - - # Install mariadb-client - yum install -y mariadb - - # Install OpenStack Clients - yum install -y python-keystoneclient python-glanceclient \ - python-novaclient python-cinderclient \ - python-neutronclient python-heatclient - - # Disable firewalld per OpenStack documentation - service firewalld stop - chkconfig firewalld off - - # Install Magnum Client - git clone http://github.com/openstack/python-magnumclient - cd python-magnumclient - sudo pip install -e . - - # Send the CFN signal - cfn-signal -e0 --data 'OK' -r 'Setup complete' '$WAIT_HANDLE' - params: - "$WAIT_HANDLE": - get_resource: node_wait_handle - networks: - - port: - get_resource: kolla_node_eth0 - - port: - get_resource: kolla_node_eth1 - - kolla_node_eth0: - type: "OS::Neutron::Port" - properties: - network_id: - get_param: fixed_network_id - security_groups: - - get_resource: secgroup_base - - get_resource: secgroup_kolla - fixed_ips: - - subnet_id: - get_param: fixed_subnet_id - - kolla_node_eth1: - type: "OS::Neutron::Port" - properties: - network_id: - get_param: container_external_network_id - security_groups: - - get_resource: secgroup_all_open - fixed_ips: - - subnet_id: - get_param: container_external_subnet_id - - kolla_node_floating: - type: "OS::Neutron::FloatingIP" - properties: - floating_network_id: - get_param: external_network_id - port_id: - get_resource: kolla_node_eth0 - -outputs: - - kolla_node_ip_eth0: - value: {get_attr: [kolla_node_eth0, fixed_ips, 0, ip_address]} - - kolla_node_external_ip: - value: {get_attr: [kolla_node_floating, floating_ip_address]} diff --git a/devenv/local.yaml.example b/devenv/local.yaml.example deleted file mode 100644 index 8f76cd835..000000000 --- a/devenv/local.yaml.example +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - ssh_key_name: - external_network_id: - container_external_network_id: - container_external_subnet_id: diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile deleted file mode 100644 index c2c1d7f68..000000000 --- a/vagrant/Vagrantfile +++ /dev/null @@ -1,168 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -require "ipaddr" - -# Either libvirt or virtualbox -PROVIDER = "libvirt" - -PROVIDER_DEFAULTS = { - libvirt: { - base_image: "centos/7", - bridge_interface: "virbr0", - vagrant_shared_folder: "/home/vagrant/sync", - sync_method: "nfs", - }, - virtualbox: { - base_image: "puppetlabs/centos-7.0-64-puppet", - bridge_interface: "wlp3s0b1", - vagrant_shared_folder: "/vagrant", - sync_method: "virtualbox", - }, -} - -# Whether to do Multi-node or All-in-One deployment -MULTINODE=false - -# The following is only used when deploying in Multi-nodes -NUMBER_OF_CONTROL_NODES=3 -NUMBER_OF_COMPUTE_NODES=1 -NUMBER_OF_STORAGE_NODES=1 -NUMBER_OF_NETWORK_NODES=1 - -# Configure a new SSH key and config so the operator is able to connect with -# the other cluster nodes. -unless File.file?("./vagrantkey") - system("ssh-keygen -f ./vagrantkey -N '' -C this-is-vagrant") -end - -def get_default(setting) - PROVIDER_DEFAULTS[PROVIDER.to_sym][setting] -end - -Vagrant.configure(2) do |config| - config.vm.box = get_default(:base_image) - - # Next to the hostonly NAT-network there is a host-only network with all - # nodes attached. Plus, each node receives a 3rd adapter connected to the - # outside public network. - config.vm.network "private_network", type: "dhcp" - config.vm.network "public_network", dev: get_default(:bridge_interface), mode: 'bridge', type: 'bridge' - - my_privatekey = File.read(File.join(File.dirname(__FILE__), "vagrantkey")) - my_publickey = File.read(File.join(File.dirname(__FILE__), "vagrantkey.pub")) - - config.vm.provision :shell, inline: <<-EOS - mkdir -p /root/.ssh - echo '#{my_privatekey}' > /root/.ssh/id_rsa - chmod 600 /root/.ssh/id_rsa - echo '#{my_publickey}' > /root/.ssh/authorized_keys - chmod 600 /root/.ssh/authorized_keys - echo '#{my_publickey}' > /root/.ssh/id_rsa.pub - chmod 644 /root/.ssh/id_rsa.pub - mkdir -p /home/vagrant/.ssh - echo '#{my_privatekey}' >> /home/vagrant/.ssh/id_rsa - chmod 600 /home/vagrant/.ssh/* - echo 'Host *' > ~vagrant/.ssh/config - echo StrictHostKeyChecking no >> ~vagrant/.ssh/config - chown -R vagrant: /home/vagrant/.ssh - EOS - - config.hostmanager.enabled = true - # Make sure hostmanager picks IP address of eth1 - config.hostmanager.ip_resolver = proc do |vm, resolving_vm| - case PROVIDER - when "libvirt" - if vm.name - `virsh -c qemu:///system net-dhcp-leases vagrant-private-dhcp | awk -F'[ /]+' '/#{vm.name} / {print $6}'`.chop - end - when "virtualbox" - if vm.id - `VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP"`.split()[1] - end - end - end - - # The operator controls the deployment - config.vm.define "operator" do |admin| - admin.vm.hostname = "operator.local" - admin.vm.provision :shell, path: "bootstrap.sh", args: "operator #{MULTINODE ? 'multinode' : 'aio'}" - admin.vm.synced_folder "..", "/home/vagrant/kolla", create:"True", type: get_default(:sync_method) - admin.vm.synced_folder "storage/operator/", "/data/host", create:"True", type: get_default(:sync_method) - admin.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) - admin.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true - admin.vm.provider PROVIDER do |vm| - vm.memory = MULTINODE ? 1024 : 4096 - if PROVIDER == 'libvirt' - # This only works with libvirt provider. - # We should be able to do something similar for virtualbox - # http://askubuntu.com/questions/317338/how-can-i-increase-disk-size-on-a-vagrant-vm - vm.machine_virtual_size = 40 - end - end - admin.hostmanager.aliases = "operator" - end - - if MULTINODE - # Build compute nodes - (1..NUMBER_OF_COMPUTE_NODES).each do |i| - config.vm.define "compute0#{i}" do |compute| - compute.vm.hostname = "compute0#{i}.local" - compute.vm.provision :shell, path: "bootstrap.sh" - compute.vm.synced_folder "storage/compute/", "/data/host", create:"True", type: get_default(:sync_method) - compute.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) - compute.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true - compute.vm.provider PROVIDER do |vm| - vm.memory = 1024 - end - compute.hostmanager.aliases = "compute0#{i}" - end - end - - # Build storage nodes - (1..NUMBER_OF_STORAGE_NODES).each do |i| - config.vm.define "storage0#{i}" do |storage| - storage.vm.hostname = "storage0#{i}.local" - storage.vm.provision :shell, path: "bootstrap.sh" - storage.vm.synced_folder "storage/storage/", "/data/host", create:"True", type: get_default(:sync_method) - storage.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) - storage.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true - storage.vm.provider PROVIDER do |vm| - vm.memory = 1024 - end - storage.hostmanager.aliases = "storage0#{i}" - end - end - - # Build network nodes - (1..NUMBER_OF_NETWORK_NODES).each do |i| - config.vm.define "network0#{i}" do |network| - network.vm.hostname = "network0#{i}.local" - network.vm.provision :shell, path: "bootstrap.sh" - network.vm.synced_folder "storage/network/", "/data/host", create:"True", type: get_default(:sync_method) - network.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) - network.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true - network.vm.provider PROVIDER do |vm| - vm.memory = 1024 - end - network.hostmanager.aliases = "network0#{i}" - end - end - - # Build control nodes - (1..NUMBER_OF_CONTROL_NODES).each do |i| - config.vm.define "control0#{i}" do |control| - control.vm.hostname = "control0#{i}.local" - control.vm.provision :shell, path: "bootstrap.sh" - control.vm.synced_folder "storage/control/", "/data/host", create:"True", type: get_default(:sync_method) - control.vm.synced_folder "storage/shared/", "/data/shared", create:"True", type: get_default(:sync_method) - control.vm.synced_folder ".", get_default(:vagrant_shared_folder), disabled: true - control.vm.provider PROVIDER do |vm| - vm.memory = 2048 - end - control.hostmanager.aliases = "control0#{i}" - end - end - end - -end diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh deleted file mode 100644 index 889942922..000000000 --- a/vagrant/bootstrap.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env bash -# -# Bootstrap script to configure all nodes. -# - -export http_proxy= -export https_proxy= - -if [ $2 = 'aio' ]; then - # Run registry on port 4000 since it may collide with keystone when doing AIO - REGISTRY_PORT=4000 - SUPPORT_NODE=operator -else - REGISTRY_PORT=5000 - SUPPORT_NODE=support01 -fi -REGISTRY=operator.local:${REGISTRY_PORT} - -# Install common packages and do some prepwork. -function prep_work { - systemctl stop firewalld - systemctl disable firewalld - - # This removes the fqdn from /etc/hosts's 127.0.0.1. This name.local will - # resolve to the public IP instead of localhost. - sed -i -r "s/^(127\.0\.0\.1\s+)(.*) `hostname` (.+)/\1 \3/" /etc/hosts - - yum install -y http://mirror.nl.leaseweb.net/epel/7/x86_64/e/epel-release-7-5.noarch.rpm - yum install -y MySQL-python vim-enhanced python-pip python-devel gcc openssl-devel libffi-devel libxml2-devel libxslt-devel && yum clean all - pip install --upgrade docker-py -} - -# Install and configure a quick&dirty docker daemon. -function install_docker { - # Allow for an externally supplied docker binary. - if [ -f "/data/docker" ]; then - cp /vagrant/docker /usr/bin/docker - chmod +x /usr/bin/docker - else - cat >/etc/yum.repos.d/docker.repo <<-EOF -[dockerrepo] -name=Docker Repository -baseurl=https://yum.dockerproject.org/repo/main/centos/7 -enabled=1 -gpgcheck=1 -gpgkey=https://yum.dockerproject.org/gpg -EOF - # Also upgrade device-mapper here because of: - # https://github.com/docker/docker/issues/12108 - yum install -y docker-engine device-mapper - - # Despite it shipping with /etc/sysconfig/docker, Docker is not configured to - # load it from it's service file. - sed -i -r "s,(ExecStart)=(.+),\1=/usr/bin/docker -d --insecure-registry ${REGISTRY} --registry-mirror=http://${REGISTRY}," /usr/lib/systemd/system/docker.service - - systemctl daemon-reload - systemctl enable docker - systemctl start docker - fi - - usermod -aG docker vagrant -} - -function resize_partition { - fdisk /dev/vda < ~/kolla/.buildconf" - fi - - cp -r ~vagrant/kolla/etc/kolla/ /etc/kolla - mkdir -p /usr/share/kolla - chown -R vagrant: /etc/kolla /usr/share/kolla - - configure_kolla - - # Make sure Ansible uses scp. - cat > ~vagrant/.ansible.cfg < ~vagrant/openrc <