Merge "Remove heat dev environment"

This commit is contained in:
Jenkins 2016-08-19 02:25:51 +00:00 committed by Gerrit Code Review
commit 7bf87dddec
7 changed files with 0 additions and 629 deletions

View File

@ -1,41 +0,0 @@
#!/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

View File

@ -1,120 +0,0 @@
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 accessing 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]}

View File

@ -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://git.openstack.org/openstack/kolla
# Add vxlan kernel module for Neutron
modprobe vxlan
# Start NTP
systemctl enable ntpd
systemctl start ntpd
# Install mariadb-client
yum -y install mariadb
# Install OpenStack Clients
yum -y install 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 https://git.openstack.org/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]}

View File

@ -1,5 +0,0 @@
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>

View File

@ -1,198 +0,0 @@
.. _heat-dev-env:
=================================
Development Environment with Heat
=================================
These `Heat <https://wiki.openstack.org/wiki/Heat>`__ templates will
deploy an *N*-node `Kolla <https://wiki.openstack.org/Kolla>`__ cluster,
where *N* is the value of the ``number_of_nodes`` parameter you specify
when creating the stack.
Kolla has recently undergone a considerable design change. The details
of the design change is addressed in this
`spec <https://review.openstack.org/#/c/153798/>`__. As part of the
design change, containers share pid and networking namespaces with the
Docker host. Therefore, containers no longer connect to a docker0 bridge
and have separate networking from the host. As a result, Kolla
networking has a configuration similar to:
.. image:: kollanet.png
:alt: Kolla networking
Sharing pid and networking namespaces is detailed in the `super
privileged
containers <http://sdake.io/2015/01/28/an-atomic-upgrade-process-for-openstack-compute-nodes/>`__
concept.
The Kolla cluster is based on Fedora 21, requires the minimum Docker
version of 1.7.0
`binary <https://docs.docker.com/installation/binaries/>`__.
These templates are designed to work with the Icehouse or Juno versions
of Heat. If using Icehouse Heat, this
`patch <https://review.openstack.org/#/c/121139/>`__ is required to
correct a bug with template validation when using the "Fn::Join"
function).
Create the Glance Image
=======================
After cloning the project, run the get-image.sh script from the
project's devenv directory:
::
$ ./get-image.sh
The script will create a Fedora 21 image with the required
modifications.
Add the image to your Glance image store:
::
$ glance image-create --name "fedora-21-x86_64" \
--file /var/lib/libvirt/images/fedora-21-x86_64 \
--disk-format qcow2 --container-format bare \
--is-public True --progress
Create the Stack
================
Copy local.yaml.example to local.yaml and edit the contents to match
your deployment environment. Here is an example of a customized
local.yaml:
::
parameters:
ssh_key_name: admin-key
external_network_id: 028d70dd-67b8-4901-8bdd-0c62b06cce2d
container_external_network_id: 028d70dd-67b8-4901-8bdd-0c62b06cce2d
container_external_subnet_id: 575770dd-6828-1101-34dd-0c62b06fjf8s
dns_nameserver: 192.168.200.1
The external\_network\_id is used by Heat to automatically assign
floating IP's to your Kolla nodes. You can then access your Kolla nodes
directly using the floating IP. The network ID is derived from the
``neutron net-list`` command.
The container\_external\_network\_id is used by the nova-network
container within the Kolla node as the FLAT\_INTERFACE. The
FLAT\_INTERFACE tells Nova what device to use (i.e. eth1) to pass
network traffic between Nova instances across Kolla nodes. This network
should be separate from the external\_network\_id above and is derived
from the 'neutron net-list' command.
The container\_external\_subnet\_id: is the subnet equivalent to
container\_external\_network\_id
Review the parameters section of kollacluster.yaml for a full list of
configuration options.
.. note:: You must provide values for:
- ``ssh_key_name``
- ``external_network_id``
- ``container_external_network_id``
- ``container_external_subnet_id``
And then create the stack, referencing that environment file:
::
$ openstack stack create -f kollacluster.yaml -e local.yaml kolla-cluster
Access the Kolla Nodes
======================
You can get the ip address of the Kolla nodes using the
``openstack stack output show`` command:
::
$ openstack stack output show kolla-cluster kolla_node_external_ip
"192.168.200.86"
You can ssh into that server as the ``fedora`` user:
::
$ ssh fedora@192.168.200.86
Once logged into your Kolla node, setup your environment. The basic
starting environment will be created using ``docker-compose``. This
environment will start up the openstack services listed in the compose
directory.
To start, setup your environment variables.
::
$ cd kolla
$ ./tools/genenv
The ``genenv`` script will create a compose/openstack.env file and an
openrc file in your current directory. The openstack.env file contains
all of your initialized environment variables, which you can edit for a
different setup.
Next, run the start script.
::
$ ./tools/kolla-compose start
The ``start`` script is responsible for starting the containers using
``docker-compose -f <osp-service-container> up -d``.
If you want to start a container set by hand use this template
::
$ docker-compose -f glance-api-registry.yml up -d
Debugging
=========
All Docker commands should be run from the directory of the Docker
binary, by default this is ``/``.
A few commands for debugging the system.
::
$ sudo ./docker images
Lists all images that have been pulled from the upstream kolla
repository thus far. This can be run on the node during the ``./start``
operation to check on the download progress.
::
$ sudo ./docker ps -a
This will show all processes that docker has started. Removing the
``-a`` will show only active processes. This can be run on the node
during the ``./start`` operation to check that the containers are
orchestrated.
::
$ sudo ./docker logs <containerid>
::
$ curl http://<NODE_IP>:3306
You can use curl to test connectivity to a container. This example
demonstrates the Mariadb service is running on the node. Output should
appear as follows
::
$ curl http://10.0.0.4:3306
Trying 10.0.0.4...
Connected to 10.0.0.4.
Escape character is '^]'.

View File

@ -65,6 +65,5 @@ Developer Docs
:maxdepth: 1 :maxdepth: 1
CONTRIBUTING CONTRIBUTING
heat-dev-env
vagrant-dev-env vagrant-dev-env
running-tests running-tests

View File

@ -360,23 +360,10 @@ Two virtualized development environment options are available for Kolla. These
options permit the development of Kolla without disrupting the host operating options permit the development of Kolla without disrupting the host operating
system. system.
If developing Kolla on an OpenStack cloud environment that supports Heat,
follow the :doc:`heat-dev-env`.
If developing Kolla on a system that provides VirtualBox or Libvirt in addition If developing Kolla on a system that provides VirtualBox or Libvirt in addition
to Vagrant, use the Vagrant virtual environment documented in to Vagrant, use the Vagrant virtual environment documented in
:doc:`vagrant-dev-env`. :doc:`vagrant-dev-env`.
Currently the Heat development environment is entirely non-functional. The
Kolla core reviewers have debated removing it from the repository but have
resisted to provide an opportunity for contributors to make Heat usable for
Kolla development. The Kolla core reviewers believe Heat would offer a great
way to develop Kolla in addition to Vagrant, bare metal, or a manually setup
virtual machine.
For more information refer to
`_bug 1562334 <https://bugs.launchpad.net/kolla/+bug/1562334>`__.
Building Container Images Building Container Images
========================= =========================