aboutsummaryrefslogtreecommitdiff
path: root/dev/heat
diff options
context:
space:
mode:
authorSteven Dake <stdake@cisco.com>2015-10-07 23:18:40 -0700
committerSteven Dake <stdake@cisco.com>2015-10-07 23:47:00 -0700
commit3b92e8714fc9a2e10cdbd73e36c05c838ba55852 (patch)
treebb6fbc7be2f6bd8faf578b64454ba16272998392 /dev/heat
parente4094152de209c1444b3ea26a4abcdf28e3d1fb2 (diff)
downloadkolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.tar.gz
kolla-3b92e8714fc9a2e10cdbd73e36c05c838ba55852.zip
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
Diffstat (limited to 'dev/heat')
-rwxr-xr-xdev/heat/get-image.sh41
-rw-r--r--dev/heat/kollacluster.yaml120
-rw-r--r--dev/heat/kollanode.yaml251
-rw-r--r--dev/heat/local.yaml.example5
4 files changed, 417 insertions, 0 deletions
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 <<EOF
+DEVICE=eth1
+BOOTPROTO=none
+ONBOOT=yes
+DEFROUTE=no
+EOF
+
+
+virt-customize \
+ --add $TARGET_DIR/$TARGET \
+ --upload $TMPFILE:/etc/sysconfig/network-scripts/ifcfg-eth1
+
+# SELinux relabeling requires virt-customize to have networking disabled
+# https://bugzilla.redhat.com/show_bug.cgi?id=1122907
+virt-customize --add $TARGET_DIR/$TARGET --selinux-relabel --no-network
+
+rm -f $TMPFILE
+
+echo "Finished building image:"
+ls -l $TARGET_DIR/$TARGET
diff --git a/dev/heat/kollacluster.yaml b/dev/heat/kollacluster.yaml
new file mode 100644
index 000000000..bfc7554cd
--- /dev/null
+++ b/dev/heat/kollacluster.yaml
@@ -0,0 +1,120 @@
+heat_template_version: 2013-05-23
+
+description: >
+ 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: <YOUR_NOVA_KEYPAIR>
+ external_network_id: <NEUTRON_EXTERNAL_NET_ID>
+ container_external_network_id: <NEUTRON_EXTERNAL_NET_ID2>
+ container_external_subnet_id: <NEUTRON_EXTERNAL_SUBNETNET_ID2>