From d2215eab04b918dcb8f9fd80670c11540ace55ef Mon Sep 17 00:00:00 2001 From: Eduardo Gonzalez Date: Tue, 2 Aug 2016 19:23:38 +0200 Subject: [PATCH] Customizations for Designate This patchset contains customization of Dockerfile of designate containers Change-Id: I846437df7c3c417846f1c771883e5eb266b78a37 Partially-implements: blueprint third-party-plugin-support Signed-off-by: Eduardo Gonzalez --- docker/designate/designate-api/Dockerfile.j2 | 16 ++++----- .../designate-backend-bind9/Dockerfile.j2 | 15 ++++---- docker/designate/designate-base/Dockerfile.j2 | 34 +++++++++++-------- .../designate/designate-central/Dockerfile.j2 | 17 ++++------ docker/designate/designate-mdns/Dockerfile.j2 | 16 ++++----- .../designate-pool-manager/Dockerfile.j2 | 25 ++++++++++++++ .../designate-poolmanager/Dockerfile.j2 | 25 -------------- docker/designate/designate-sink/Dockerfile.j2 | 24 ++++++------- 8 files changed, 83 insertions(+), 89 deletions(-) create mode 100644 docker/designate/designate-pool-manager/Dockerfile.j2 delete mode 100644 docker/designate/designate-poolmanager/Dockerfile.j2 diff --git a/docker/designate/designate-api/Dockerfile.j2 b/docker/designate/designate-api/Dockerfile.j2 index 1e45c903c9..893612e84c 100644 --- a/docker/designate/designate-api/Dockerfile.j2 +++ b/docker/designate/designate-api/Dockerfile.j2 @@ -1,22 +1,18 @@ FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - openstack-designate-api \ - && yum clean all - + {% set designate_api_packages = ['openstack-designate-api'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - designate-api \ - && apt-get clean - + {% set designate_api_packages = ['designate-api'] %} {% endif %} +RUN {{ macros.install_packages(designate_api_packages | customizable("packages")) }} {% endif %} +{% block designate_api_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER designate diff --git a/docker/designate/designate-backend-bind9/Dockerfile.j2 b/docker/designate/designate-backend-bind9/Dockerfile.j2 index bee72f3742..53b0672c23 100644 --- a/docker/designate/designate-backend-bind9/Dockerfile.j2 +++ b/docker/designate/designate-backend-bind9/Dockerfile.j2 @@ -1,24 +1,25 @@ FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + {% set designate_backend_bind9_packages = ['bind'] %} -RUN yum -y install \ - bind \ - && yum clean all \ - && mkdir -p /var/lib/kolla/ \ +RUN {{ macros.install_packages(designate_backend_bind9_packages | customizable("packages")) }} +RUN mkdir -p /var/lib/kolla/ \ && cp -pr /var/named /var/lib/kolla/var-named {% elif base_distro in ['ubuntu'] %} + {% set designate_backend_bind9_packages = ['bind9'] %} -RUN apt-get -y install --no-install-recommends \ - bind9 \ - && apt-get clean +RUN {{ macros.install_packages(designate_backend_bind9_packages | customizable("packages")) }} {% endif %} {% endif %} +{% block designate_backend_bind9_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER designate diff --git a/docker/designate/designate-base/Dockerfile.j2 b/docker/designate/designate-base/Dockerfile.j2 index 09cff56f66..3fccb13eab 100644 --- a/docker/designate/designate-base/Dockerfile.j2 +++ b/docker/designate/designate-base/Dockerfile.j2 @@ -1,5 +1,6 @@ FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} @@ -8,24 +9,27 @@ MAINTAINER {{ maintainer }} # is needed in all services. This is probably a packaging bug. We do # need the complete policy file because of some of the containers' # requiring it. Remove the package when the file is moved though. -RUN yum -y install \ - openstack-designate-api \ - openstack-designate-common \ - python-tooz \ - python2-oslo-reports \ - python2-suds \ - && yum clean all \ - && cp /etc/designate/policy.json /tmp/ \ + {% set designate_base_packages = [ + 'openstack-designate-api', + 'openstack-designate-common', + 'python-tooz', + 'python2-oslo-reports', + 'python2-suds' + ] %} + +RUN {{ macros.install_packages(designate_base_packages | customizable("packages")) }} +RUN cp /etc/designate/policy.json /tmp/ \ && rpm -e openstack-designate-api \ && mv /tmp/policy.json /etc/designate/ \ && chown designate: /etc/designate/policy.json {% elif base_distro in ['ubuntu'] %} + {% set designate_base_packages = [ + 'designate-common', + 'python-tooz' + ] %} -RUN apt-get -y install --no-install-recommends \ - designate-common \ - python-tooz \ - && apt-get clean +RUN {{ macros.install_packages(designate_base_packages | customizable("packages")) }} {% endif %} {% elif install_type == 'source' %} @@ -39,12 +43,14 @@ RUN ln -s designate-base-source/* designate \ && mv /etc/designate/rootwrap.conf.sample /etc/designate/rootwrap.conf \ && chown -R designate: /etc/designate /var/log/designate /home/designate \ && sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/designate/rootwrap.conf - {% endif %} COPY extend_start.sh /usr/local/bin/kolla_extend_start - RUN touch /usr/local/bin/kolla_designate_extend_start \ && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_designate_extend_start +{% block designate_base_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + RUN usermod -a -G kolla designate diff --git a/docker/designate/designate-central/Dockerfile.j2 b/docker/designate/designate-central/Dockerfile.j2 index ab6f60b7e0..1775ea5e40 100644 --- a/docker/designate/designate-central/Dockerfile.j2 +++ b/docker/designate/designate-central/Dockerfile.j2 @@ -1,26 +1,21 @@ FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - openstack-designate-central \ - && yum clean all - + {% set designate_central_packages = ['openstack-designate-central'] %} {% elif base_distro in ['ubuntu']%} - -RUN apt-get -y install --no-install-recommends \ - designate-central \ - && apt-get clean - + {% set designate_central_packages = ['designate-central'] %} {% endif %} +RUN {{ macros.install_packages(designate_central_packages | customizable("packages")) }} {% endif %} - COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block designate_central_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER designate diff --git a/docker/designate/designate-mdns/Dockerfile.j2 b/docker/designate/designate-mdns/Dockerfile.j2 index d5c9173991..548f4c5448 100644 --- a/docker/designate/designate-mdns/Dockerfile.j2 +++ b/docker/designate/designate-mdns/Dockerfile.j2 @@ -1,22 +1,18 @@ FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - openstack-designate-mdns \ - && yum clean all - + {% set designate_mdns_packages = ['openstack-designate-mdns'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - designate-mdns \ - && apt-get clean - + {% set designate_mdns_packages = ['designate-mdns'] %} {% endif %} +RUN {{ macros.install_packages(designate_mdns_packages | customizable("packages")) }} {% endif %} +{% block designate_mdns_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER designate diff --git a/docker/designate/designate-pool-manager/Dockerfile.j2 b/docker/designate/designate-pool-manager/Dockerfile.j2 new file mode 100644 index 0000000000..d5ee01a5aa --- /dev/null +++ b/docker/designate/designate-pool-manager/Dockerfile.j2 @@ -0,0 +1,25 @@ +FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} +MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} +# The bind9 package here is only to provide the rndc binary. + {% set designate_pool_manager_packages = [ + 'bind', + 'openstack-designate-pool-manager' + ] %} + {% elif base_distro in ['ubuntu'] %} + {% set designate_pool_manager_packages = [ + 'bind9', + 'designate-pool-manager' + ] %} + {% endif %} +RUN {{ macros.install_packages(designate_pool_manager_packages | customizable("packages")) }} +{% endif %} + +{% block designate_pool_manager_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER designate diff --git a/docker/designate/designate-poolmanager/Dockerfile.j2 b/docker/designate/designate-poolmanager/Dockerfile.j2 deleted file mode 100644 index f8ac0c9ac2..0000000000 --- a/docker/designate/designate-poolmanager/Dockerfile.j2 +++ /dev/null @@ -1,25 +0,0 @@ -FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} -MAINTAINER {{ maintainer }} - -{% if install_type == 'binary' %} - {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -# The bind9 package here is only to provide the rndc binary. -RUN yum -y install \ - bind \ - openstack-designate-pool-manager \ - && yum clean all - - {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - bind9 \ - designate-pool-manager \ - && apt-get clean - - {% endif %} -{% endif %} - -{{ include_footer }} - -USER designate diff --git a/docker/designate/designate-sink/Dockerfile.j2 b/docker/designate/designate-sink/Dockerfile.j2 index 0a419e4259..8802d73d45 100644 --- a/docker/designate/designate-sink/Dockerfile.j2 +++ b/docker/designate/designate-sink/Dockerfile.j2 @@ -1,24 +1,24 @@ FROM {{ namespace }}/{{ image_prefix }}designate-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - openstack-designate-sink \ - python-designateclient \ - && yum clean all - + {% set designate_sink_packages = [ + 'openstack-designate-sink', + 'python-designateclient' + ] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - designate-sink \ - designateclient \ - && apt-get clean - + {% set designate_sink_packages = [ + 'designate-sink', + 'designateclient' + ] %} {% endif %} +RUN {{ macros.install_packages(designate_sink_packages | customizable("packages")) }} {% endif %} +{% block designate_sink_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER designate