From 1d399461ac1678490fb7a9b697464efbfd0a8411 Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Wed, 29 Jun 2016 17:05:30 +0200 Subject: [PATCH] Add Senlin Docker container Change-Id: I52e08e2df77106969c5975ebda2510ea8aefa8b5 Partially-implements: bp senlin-container Signed-off-by: Eduardo Gonzalez --- docker/senlin/senlin-api/Dockerfile.j2 | 16 +++++++++++++++ docker/senlin/senlin-api/extend_start.sh | 8 ++++++++ docker/senlin/senlin-base/Dockerfile.j2 | 25 +++++++++++++++++++++++ docker/senlin/senlin-base/extend_start.sh | 10 +++++++++ docker/senlin/senlin-engine/Dockerfile.j2 | 13 ++++++++++++ kolla/common/config.py | 4 ++++ tests/test_build.py | 6 ++++-- 7 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 docker/senlin/senlin-api/Dockerfile.j2 create mode 100644 docker/senlin/senlin-api/extend_start.sh create mode 100644 docker/senlin/senlin-base/Dockerfile.j2 create mode 100644 docker/senlin/senlin-base/extend_start.sh create mode 100644 docker/senlin/senlin-engine/Dockerfile.j2 diff --git a/docker/senlin/senlin-api/Dockerfile.j2 b/docker/senlin/senlin-api/Dockerfile.j2 new file mode 100644 index 0000000000..db594e1c47 --- /dev/null +++ b/docker/senlin/senlin-api/Dockerfile.j2 @@ -0,0 +1,16 @@ +FROM {{ namespace }}/{{ image_prefix }}senlin-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_senlin_extend_start +RUN chmod 755 /usr/local/bin/kolla_senlin_extend_start + +{{ include_footer }} + +USER senlin diff --git a/docker/senlin/senlin-api/extend_start.sh b/docker/senlin/senlin-api/extend_start.sh new file mode 100644 index 0000000000..2de5b4c650 --- /dev/null +++ b/docker/senlin/senlin-api/extend_start.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + senlin-manage --config-file /etc/senlin/senlin.conf db_sync + exit 0 +fi diff --git a/docker/senlin/senlin-base/Dockerfile.j2 b/docker/senlin/senlin-base/Dockerfile.j2 new file mode 100644 index 0000000000..cb3a4894f0 --- /dev/null +++ b/docker/senlin/senlin-base/Dockerfile.j2 @@ -0,0 +1,25 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% elif install_type == 'source' %} + +ADD senlin-base-archive /senlin-base-source +RUN ln -s senlin-base-source/* senlin \ + && useradd --user-group senlin \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /senlin \ + && mkdir -p /etc/senlin \ + && cp -r /senlin/etc/senlin/* /etc/senlin \ + && chown -R senlin: /etc/senlin + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla senlin \ + && touch /usr/local/bin/kolla_senlin_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_senlin_extend_start diff --git a/docker/senlin/senlin-base/extend_start.sh b/docker/senlin/senlin-base/extend_start.sh new file mode 100644 index 0000000000..02886d4597 --- /dev/null +++ b/docker/senlin/senlin-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/senlin" ]]; then + mkdir -p /var/log/kolla/senlin +fi +if [[ $(stat -c %a /var/log/kolla/senlin) != "755" ]]; then + chmod 755 /var/log/kolla/senlin +fi + +source /usr/local/bin/kolla_senlin_extend_start diff --git a/docker/senlin/senlin-engine/Dockerfile.j2 b/docker/senlin/senlin-engine/Dockerfile.j2 new file mode 100644 index 0000000000..565c71bf4f --- /dev/null +++ b/docker/senlin/senlin-engine/Dockerfile.j2 @@ -0,0 +1,13 @@ +FROM {{ namespace }}/{{ image_prefix }}senlin-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{{ include_footer }} + +USER senlin diff --git a/kolla/common/config.py b/kolla/common/config.py index 0aceb990a1..83494c5d38 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -254,6 +254,10 @@ SOURCES = { 'type': 'url', 'location': ('http://tarballs.openstack.org/sahara/' 'sahara-master.tar.gz')}, + 'senlin-base': { + 'type': 'url', + 'location': ('http://tarballs.openstack.org/senlin/' + 'senlin-master.tar.gz')}, 'swift-base': { 'type': 'url', 'location': ('http://tarballs.openstack.org/swift/' diff --git a/tests/test_build.py b/tests/test_build.py index e5832aaac1..85f6b5c011 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -67,7 +67,8 @@ class BuildTest(object): class BuildTestCentosBinary(BuildTest, base.BaseTestCase): - excluded_images = ["kuryr"] + excluded_images = ["kuryr", + "senlin-base"] def setUp(self): super(BuildTestCentosBinary, self).setUp() @@ -104,7 +105,8 @@ class BuildTestUbuntuSource(BuildTest, base.BaseTestCase): class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): - excluded_images = ["kuryr"] + excluded_images = ["kuryr", + "senlin-base"] def setUp(self): super(BuildTestOracleLinuxBinary, self).setUp()