Heat Docker agent built with Dockerfile

This includes a Dockerfile which builds the heat-docker-agent container
with all the necessary bits to make it work.  This also includes fixes
for VLAN networking to use.

Change-Id: I2f4edf0a91bddede810ddf1765296be23c4bbebd
Co-Authored-by: Jeff Peeler <jpeeler@redhat.com>
This commit is contained in:
Ian Main 2015-12-03 21:05:44 +00:00 committed by Jeff Peeler
parent daba10162b
commit eab90f9402
3 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,24 @@
FROM centos:7
MAINTAINER "Jeff Peeler" <jpeeler@redhat.com>
ENV container docker
ENV DOCKER_HOST unix:///var/run/docker.sock
# Just use a script to configure the agent container. This way we can
# Split up the operations and do it all in a single layer.
ADD configure_container.sh /tmp/
RUN /tmp/configure_container.sh
# This is a script which:
# - Copies the existing network interface configs from the host to the agent.
# - Configures os-net-config
# - Runs os-net-config in the agent.
#
# All of this is triggered from the heat templates.
ADD run-os-net-config /usr/local/bin/
# create volumes to share the host directories
VOLUME [ "/var/lib/cloud"]
VOLUME [ "/var/lib/heat-cfntools" ]
CMD /usr/bin/os-collect-config

View File

@ -0,0 +1,97 @@
#!/bin/bash
# Doing this in a seperate script lets us do it step by step with a single docker layer.
yum -y install http://rdoproject.org/repos/openstack-liberty/rdo-release-liberty.rpm
yum update -y \
&& yum clean all
yum install -y \
initscripts \
dhcp-client \
ethtool \
NetworkManager
# We shouldn't need python-zaqarclient here for os-collect-config.
# The rpm should pull it in but it's not doing that..
# Also note gcc and python-pip, python-devel, and libyaml-devel are
# required for docker-compose. It would be nice to package that or use
# somethinge else.
yum install -y \
openstack-tripleo-puppet-elements \
openstack-tripleo-image-elements \
openstack-heat-templates \
openstack-puppet-modules \
os-apply-config \
os-collect-config \
os-refresh-config \
os-net-config \
jq \
python-zaqarclient \
gcc \
libyaml-devel \
python-devel \
python-pip \
openvswitch \
puppet
# heat-config-docker-compose
# TODO: fix! yet another requirement for docker-compose
pip install dpath functools32
yum install -y \
docker
pip install -U docker-compose
yum clean all
# Heat config setup.
mkdir -p /var/lib/heat-config/hooks
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config-puppet/install.d/hook-puppet.py \
/var/lib/heat-config/hooks/puppet
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config-script/install.d/hook-script.py \
/var/lib/heat-config/hooks/script
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config-docker-compose/install.d/hook-docker-compose.py \
/var/lib/heat-config/hooks/docker-compose
# Install puppet modules
mkdir -p /etc/puppet/modules
ln -sf /usr/share/openstack-puppet/modules/* /etc/puppet/modules/
# And puppet hiera
mkdir -p /usr/libexec/os-apply-config/templates/etc/puppet
ln -sf /usr/share/tripleo-puppet-elements/hiera/os-apply-config/etc/puppet/hiera.yaml /usr/libexec/os-apply-config/templates/etc/puppet/
ln -sf /etc/puppet/hiera.yaml /etc/hiera.yaml
# Configure os-*
mkdir -p /usr/libexec/os-refresh-config/configure.d
ln -sf /usr/share/tripleo-image-elements/os-apply-config/os-refresh-config/configure.d/20-os-apply-config \
/usr/libexec/os-refresh-config/configure.d/
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config-docker-compose/os-refresh-config/configure.d/50-heat-config-docker-compose \
/usr/libexec/os-refresh-config/configure.d/
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config/os-refresh-config/configure.d/55-heat-config \
/usr/libexec/os-refresh-config/configure.d/
ln -sf /usr/share/tripleo-puppet-elements/hiera/os-refresh-config/configure.d/40-hiera-datafiles \
/usr/libexec/os-refresh-config/configure.d/
mkdir -p /usr/libexec/os-refresh-config/post-configure.d
ln -sf /usr/share/tripleo-image-elements/os-refresh-config/os-refresh-config/post-configure.d/99-refresh-completed \
/usr/libexec/os-refresh-config/post-configure.d/
mkdir -p /usr/libexec/os-apply-config/templates/var/run/heat-config
echo "{{deployments}}" > /usr/libexec/os-apply-config/templates/var/run/heat-config/heat-config
ln -sf /usr/share/openstack-heat-templates/software-config/elements/heat-config/bin/heat-config-notify \
/usr/local/bin/
mkdir -p /usr/libexec/os-apply-config/templates/etc/os-net-config/
ln -sf /usr/share/tripleo-image-elements/os-net-config/os-apply-config/etc/os-net-config/config.json \
/usr/libexec/os-apply-config/templates/etc/os-net-config/
mkdir -p /usr/libexec/os-apply-config/templates/etc/
ln -sf /usr/share/tripleo-image-elements/os-collect-config/os-apply-config/etc/os-collect-config.conf \
/usr/libexec/os-apply-config/templates/etc

View File

@ -0,0 +1,12 @@
#!/bin/bash
set -eux
# Be sure to copy existing interface configs from the host so that we can properly
# ifdown them before bringing up new config.
cp /host/etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/
NET_CONFIG=$(os-apply-config --key os_net_config --type raw --key-default '')
if [ -n "$NET_CONFIG" ]; then
os-net-config -c /etc/os-net-config/config.json -v
fi