From 2dae2f080ca814cfc6c753159540a74778ad1c33 Mon Sep 17 00:00:00 2001 From: caowei Date: Tue, 8 Nov 2016 22:57:51 +0800 Subject: [PATCH] Add karbor container Change-Id: I8ed8840d06a1fdb87aad51f438ac6c38c1c14642 Partially-implements: bp karbor-container --- docker/karbor/karbor-api/Dockerfile.j2 | 20 +++++++++++++ docker/karbor/karbor-api/extend_start.sh | 8 +++++ docker/karbor/karbor-base/Dockerfile.j2 | 29 +++++++++++++++++++ docker/karbor/karbor-base/extend_start.sh | 10 +++++++ .../karbor-operationengine/Dockerfile.j2 | 17 +++++++++++ docker/karbor/karbor-protection/Dockerfile.j2 | 17 +++++++++++ kolla/common/config.py | 12 +++++--- .../notes/add-karbor-e6cfd97f965a4a9f.yaml | 5 ++++ tests/test_build.py | 9 ++++-- 9 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 docker/karbor/karbor-api/Dockerfile.j2 create mode 100644 docker/karbor/karbor-api/extend_start.sh create mode 100644 docker/karbor/karbor-base/Dockerfile.j2 create mode 100644 docker/karbor/karbor-base/extend_start.sh create mode 100644 docker/karbor/karbor-operationengine/Dockerfile.j2 create mode 100644 docker/karbor/karbor-protection/Dockerfile.j2 create mode 100644 releasenotes/notes/add-karbor-e6cfd97f965a4a9f.yaml diff --git a/docker/karbor/karbor-api/Dockerfile.j2 b/docker/karbor/karbor-api/Dockerfile.j2 new file mode 100644 index 0000000000..d8bbe78184 --- /dev/null +++ b/docker/karbor/karbor-api/Dockerfile.j2 @@ -0,0 +1,20 @@ +FROM {{ namespace }}/{{ image_prefix }}karbor-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block karbor_api_header %}{% endblock %} + +{% 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_karbor_extend_start +RUN chmod 755 /usr/local/bin/kolla_karbor_extend_start + +{% block karbor_api_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER karbor diff --git a/docker/karbor/karbor-api/extend_start.sh b/docker/karbor/karbor-api/extend_start.sh new file mode 100644 index 0000000000..c5102072e7 --- /dev/null +++ b/docker/karbor/karbor-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 + karbor-manage db sync + exit 0 +fi diff --git a/docker/karbor/karbor-base/Dockerfile.j2 b/docker/karbor/karbor-base/Dockerfile.j2 new file mode 100644 index 0000000000..26484070f1 --- /dev/null +++ b/docker/karbor/karbor-base/Dockerfile.j2 @@ -0,0 +1,29 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block karbor_base_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% elif install_type == 'source' %} + +ADD karbor-base-archive /karbor-base-source +RUN ln -s karbor-base-source/* karbor \ + && useradd --user-group --create-home --home-dir /var/lib/karbor karbor \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /karbor \ + && mkdir -p /etc/karbor \ + && cp -r /karbor/etc/* /etc/karbor/ \ + && chown -R karbor: /etc/karbor + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla karbor \ + && touch /usr/local/bin/kolla_karbor_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_karbor_extend_start + +{% block karbor_base_footer %}{% endblock %} diff --git a/docker/karbor/karbor-base/extend_start.sh b/docker/karbor/karbor-base/extend_start.sh new file mode 100644 index 0000000000..db0fdacc82 --- /dev/null +++ b/docker/karbor/karbor-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/karbor" ]]; then + mkdir -p /var/log/kolla/karbor +fi +if [[ $(stat -c %a /var/log/kolla/karbor) != "755" ]]; then + chmod 755 /var/log/kolla/karbor +fi + +. /usr/local/bin/kolla_karbor_extend_start diff --git a/docker/karbor/karbor-operationengine/Dockerfile.j2 b/docker/karbor/karbor-operationengine/Dockerfile.j2 new file mode 100644 index 0000000000..745fcd4a83 --- /dev/null +++ b/docker/karbor/karbor-operationengine/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ image_prefix }}karbor-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block karbor_operationengine_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block karbor_operationengine_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER karbor diff --git a/docker/karbor/karbor-protection/Dockerfile.j2 b/docker/karbor/karbor-protection/Dockerfile.j2 new file mode 100644 index 0000000000..9be5cca0b0 --- /dev/null +++ b/docker/karbor/karbor-protection/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ image_prefix }}karbor-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block karbor_protection_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block karbor_protection_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER karbor diff --git a/kolla/common/config.py b/kolla/common/config.py index 72c87e4978..6c7b734df1 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -46,10 +46,10 @@ _PROFILE_OPTS = [ help='Main images'), cfg.ListOpt('aux', default=['aodh', 'cloudkitty', 'congress', 'designate', - 'freezer', 'gnocchi', 'influxdb', 'ironic', 'kuryr', - 'magnum', 'manila', 'mistral', 'murano', 'panko', - 'rally', 'sahara', 'searchlight', 'senlin', 'solum', - 'telegraf', 'trove', 'zaqar'], + 'freezer', 'gnocchi', 'influxdb', 'ironic', 'karbor', + 'kuryr', 'magnum', 'manila', 'mistral', 'murano', + 'panko', 'rally', 'sahara', 'searchlight', 'senlin', + 'solum', 'telegraf', 'trove', 'zaqar'], help='Aux Images'), cfg.ListOpt('default', default=['chrony', 'cron', 'kolla-toolbox', 'glance', @@ -226,6 +226,10 @@ SOURCES = { 'type': 'url', 'location': ('http://tarballs.openstack.org/ironic-inspector/' 'ironic-inspector-master.tar.gz')}, + 'karbor-base': { + 'type': 'url', + 'location': ('http://tarballs.openstack.org/karbor/' + 'karbor-master.tar.gz')}, 'keystone-base': { 'type': 'url', 'location': ('http://tarballs.openstack.org/keystone/' diff --git a/releasenotes/notes/add-karbor-e6cfd97f965a4a9f.yaml b/releasenotes/notes/add-karbor-e6cfd97f965a4a9f.yaml new file mode 100644 index 0000000000..1c24f66f6b --- /dev/null +++ b/releasenotes/notes/add-karbor-e6cfd97f965a4a9f.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add Karbor Dockerfile , Karbor is an OpenStack project + that provides a pluggable framework for protecting and + restoring Data and Metadata. diff --git a/tests/test_build.py b/tests/test_build.py index 8b240c017b..c786cf9b08 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -65,7 +65,8 @@ class BuildTest(object): class BuildTestCentosBinary(BuildTest, base.BaseTestCase): - excluded_images = ["kuryr-base", + excluded_images = ["karbor-base", + "kuryr-base", "neutron-sfc-agent", "searchlight-base", "senlin-base", @@ -94,7 +95,8 @@ class BuildTestCentosSource(BuildTest, base.BaseTestCase): class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): - excluded_images = ["kuryr-base", + excluded_images = ["karbor-base", + "kuryr-base", "neutron-sfc-agent", "searchlight-base", "senlin-base", @@ -124,7 +126,8 @@ class BuildTestUbuntuSource(BuildTest, base.BaseTestCase): class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): - excluded_images = ["kuryr-base", + excluded_images = ["karbor-base", + "kuryr-base", "neutron-sfc-agent", "searchlight-base", "senlin-base",