From 3801d4b1402778877982f9c545895ea7bfd63d96 Mon Sep 17 00:00:00 2001 From: caowei Date: Mon, 15 May 2017 11:09:10 +0800 Subject: [PATCH] Add dragonflow container Change-Id: I8ab47f96a86c524e14a2c65dd58f1f8fa54d0895 Partially-implements: blueprint dragonflow --- .../dragonflow/dragonflow-base/Dockerfile.j2 | 49 +++++++++++++++++++ .../dragonflow-base/extend_start.sh | 12 +++++ .../dragonflow-controller/Dockerfile.j2 | 16 ++++++ .../dragonflow-metadata/Dockerfile.j2 | 16 ++++++ .../Dockerfile.j2 | 16 ++++++ kolla/common/config.py | 9 ++++ .../add-dragonflow-da8ff734139c9de5.yaml | 4 ++ tests/test_build.py | 4 ++ 8 files changed, 126 insertions(+) create mode 100644 docker/dragonflow/dragonflow-base/Dockerfile.j2 create mode 100644 docker/dragonflow/dragonflow-base/extend_start.sh create mode 100644 docker/dragonflow/dragonflow-controller/Dockerfile.j2 create mode 100644 docker/dragonflow/dragonflow-metadata/Dockerfile.j2 create mode 100644 docker/dragonflow/dragonflow-publisher-service/Dockerfile.j2 create mode 100644 releasenotes/notes/add-dragonflow-da8ff734139c9de5.yaml diff --git a/docker/dragonflow/dragonflow-base/Dockerfile.j2 b/docker/dragonflow/dragonflow-base/Dockerfile.j2 new file mode 100644 index 0000000000..50d191e913 --- /dev/null +++ b/docker/dragonflow/dragonflow-base/Dockerfile.j2 @@ -0,0 +1,49 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block dragonflow_base_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{{ macros.configure_user(name='dragonflow') }} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% elif install_type == 'source' %} + +{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + {% set dragonflow_base_packages = [ + 'zeromq' + ] %} + +{% elif base_distro in ['debian', 'ubuntu'] %} + {% set dragonflow_base_packages = [ + 'libzmq1' + ] %} + +{% endif %} + +{{ macros.install_packages(dragonflow_base_packages | customizable("packages")) }} + +{% set dragonflow_base_pip_packages = [ + '/dragonflow' +] %} + +ADD dragonflow-base-archive /dragonflow-base-source +RUN ln -s dragonflow-base-source/* dragonflow \ + && {{ macros.install_pip(dragonflow_base_pip_packages | customizable("pip_packages")) }} \ + && mkdir -p /etc/dragonflow \ + && cp -r /dragonflow/etc/* /etc/dragonflow/ \ + && chown -R dragonflow: /etc/dragonflow + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN touch /usr/local/bin/kolla_dragonflow_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_dragonflow_extend_start + +{% block dragonflow_base_footer %}{% endblock %} diff --git a/docker/dragonflow/dragonflow-base/extend_start.sh b/docker/dragonflow/dragonflow-base/extend_start.sh new file mode 100644 index 0000000000..eeb896f786 --- /dev/null +++ b/docker/dragonflow/dragonflow-base/extend_start.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Create log dir for dragonflow logs +LOG_DIR="/var/log/kolla/dragonflow" +if [[ ! -d "${LOG_DIR}" ]]; then + mkdir -p ${LOG_DIR} +fi +if [[ $(stat -c %a ${LOG_DIR}) != "755" ]]; then + chmod 755 ${LOG_DIR} +fi + +. /usr/local/bin/kolla_dragonflow_extend_start diff --git a/docker/dragonflow/dragonflow-controller/Dockerfile.j2 b/docker/dragonflow/dragonflow-controller/Dockerfile.j2 new file mode 100644 index 0000000000..5efaa3115f --- /dev/null +++ b/docker/dragonflow/dragonflow-controller/Dockerfile.j2 @@ -0,0 +1,16 @@ +FROM {{ namespace }}/{{ image_prefix }}dragonflow-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block dragonflow_controller_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block dragonflow_controller_footer %}{% endblock %} +{% block footer %}{% endblock %} + +USER dragonflow diff --git a/docker/dragonflow/dragonflow-metadata/Dockerfile.j2 b/docker/dragonflow/dragonflow-metadata/Dockerfile.j2 new file mode 100644 index 0000000000..93f93a7243 --- /dev/null +++ b/docker/dragonflow/dragonflow-metadata/Dockerfile.j2 @@ -0,0 +1,16 @@ +FROM {{ namespace }}/{{ image_prefix }}dragonflow-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block dragonflow_metadata_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block dragonflow_metadata_footer %}{% endblock %} +{% block footer %}{% endblock %} + +USER dragonflow diff --git a/docker/dragonflow/dragonflow-publisher-service/Dockerfile.j2 b/docker/dragonflow/dragonflow-publisher-service/Dockerfile.j2 new file mode 100644 index 0000000000..8c55ad58e0 --- /dev/null +++ b/docker/dragonflow/dragonflow-publisher-service/Dockerfile.j2 @@ -0,0 +1,16 @@ +FROM {{ namespace }}/{{ image_prefix }}dragonflow-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block dragonflow_publisher_service_header %}{% endblock %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block dragonflow_publisher_service_footer %}{% endblock %} +{% block footer %}{% endblock %} + +USER dragonflow diff --git a/kolla/common/config.py b/kolla/common/config.py index fefe483866..1baef94c5c 100755 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -95,6 +95,7 @@ _PROFILE_OPTS = [ 'cloudkitty', 'congress', 'designate', + 'dragonflow', 'freezer', 'gnocchi', 'influxdb', @@ -303,6 +304,10 @@ SOURCES = { 'type': 'url', 'location': ('$tarballs_base/designate/' 'designate-master.tar.gz')}, + 'dragonflow-base': { + 'type': 'url', + 'location': ('$tarballs_base/dragonflow/' + 'dragonflow-master.tar.gz')}, 'freezer-api': { 'type': 'url', 'location': ('$tarballs_base/freezer-api/' @@ -839,6 +844,10 @@ USERS = { 'zun-user': { 'uid': 42463, 'gid': 42463, + }, + 'dragonflow-user': { + 'uid': 42464, + 'gid': 42464, } } diff --git a/releasenotes/notes/add-dragonflow-da8ff734139c9de5.yaml b/releasenotes/notes/add-dragonflow-da8ff734139c9de5.yaml new file mode 100644 index 0000000000..3ea2ece1c8 --- /dev/null +++ b/releasenotes/notes/add-dragonflow-da8ff734139c9de5.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add Dragonflow Dockerfile , Dragonflow is a distributed sdn framework + for neutron and it is in the big-tent. diff --git a/tests/test_build.py b/tests/test_build.py index 47d7ed7570..8a0ff58446 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -74,6 +74,7 @@ class BuildTest(object): class BuildTestCentosBinary(BuildTest, base.BaseTestCase): excluded_images = [ "bifrost-base", + "dragonflow-base", "freezer-base", "kafka", "karbor-base", @@ -115,6 +116,7 @@ class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): "bifrost-base", "cloudkitty-base", "congress-base", + "dragonflow-base", "freezer-base", "heat-all", "karbor-base", @@ -156,6 +158,7 @@ class BuildTestDebianBinary(BuildTest, base.BaseTestCase): "bifrost-base", "cloudkitty-base", "congress-base", + "dragonflow-base", "freezer-base", "heat-all", "karbor-base", @@ -195,6 +198,7 @@ class BuildTestDebianSource(BuildTest, base.BaseTestCase): class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): excluded_images = [ "bifrost-base", + "dragonflow-base", "freezer-base", "kafka", "karbor-base",