From 9688f95f58014f06fe0101eb319ed671425bb4c4 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Wed, 3 Aug 2016 20:52:37 +0200 Subject: [PATCH] Customizations for Neutron Change-Id: I5dbb030943abfa7eccc424859b694a508358c123 Partially-implements: blueprint third-party-plugin-support Co-Authored-By: Michal (inc0) Jastrzebski Co-Authored-By: Paul Bourke --- docker/neutron/neutron-base/Dockerfile.j2 | 88 +++++++++++-------- .../neutron/neutron-dhcp-agent/Dockerfile.j2 | 12 ++- docker/neutron/neutron-l3-agent/Dockerfile.j2 | 27 +++--- .../neutron/neutron-lbaas-agent/Dockerfile.j2 | 43 ++++----- .../neutron-linuxbridge-agent/Dockerfile.j2 | 41 ++++----- .../neutron-metadata-agent/Dockerfile.j2 | 12 ++- .../neutron-openvswitch-agent/Dockerfile.j2 | 23 +++-- docker/neutron/neutron-server/Dockerfile.j2 | 23 +++-- 8 files changed, 148 insertions(+), 121 deletions(-) diff --git a/docker/neutron/neutron-base/Dockerfile.j2 b/docker/neutron/neutron-base/Dockerfile.j2 index e5f9de390a..05a2b7c75b 100644 --- a/docker/neutron/neutron-base/Dockerfile.j2 +++ b/docker/neutron/neutron-base/Dockerfile.j2 @@ -1,61 +1,73 @@ 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'] %} -RUN yum -y install \ - openstack-neutron \ - openstack-neutron-ml2 \ - openvswitch \ - openstack-neutron-lbaas \ - python-openvswitch \ - && yum clean all + {% set neutron_base_packages = [ + 'openstack-neutron', + 'openstack-neutron-lbaas', + 'openstack-neutron-ml2', + 'openvswitch', + 'python-openvswitch' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - iproute2 \ - neutron-plugin-ml2 \ - neutron-server \ - openvswitch-switch \ - python-openvswitch \ - neutron-lbaas-agent \ - && apt-get clean \ - && mkdir -p /usr/share/neutron \ + {% set neutron_base_packages = [ + 'iproute2', + 'neutron-lbaas-agent', + 'neutron-plugin-ml2', + 'neutron-server', + 'openvswitch-switch', + 'python-openvswitch' + ] %} + + {% endif %} + +{{ macros.install_packages(neutron_base_packages | customizable("packages")) }} + + {% if base_distro in ['ubuntu'] %} + +RUN mkdir -p /usr/share/neutron \ && ln -s /etc/neutron/api-paste.ini /usr/share/neutron/api-paste.ini {% endif %} + {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - conntrack-tools \ - dnsmasq \ - dnsmasq-utils \ - ipset \ - openvswitch \ - python-openvswitch \ - uuid \ - && yum clean all + {% set neutron_base_packages = [ + 'conntrack-tools', + 'dnsmasq', + 'dnsmasq-utils', + 'ipset', + 'openvswitch', + 'python-openvswitch', + 'uuid' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - iputils-arping \ - conntrack \ - dnsmasq \ - dnsmasq-utils \ - iproute2 \ - ipset \ - iptables \ - openvswitch-switch \ - python-openvswitch \ - uuid-runtime \ - && apt-get clean + {% set neutron_base_packages = [ + 'conntrack', + 'dnsmasq', + 'dnsmasq-utils', + 'iproute2', + 'ipset', + 'iptables', + 'iputils-arping', + 'openvswitch-switch', + 'python-openvswitch', + 'uuid-runtime' + ] %} {% endif %} +{{ macros.install_packages(neutron_base_packages | customizable("packages")) }} + ADD neutron-base-archive /neutron-base-source RUN ln -s neutron-base-source/* neutron \ && useradd --user-group neutron \ @@ -78,3 +90,5 @@ RUN usermod -a -G kolla neutron \ && chmod 440 /etc/sudoers.d/kolla_neutron_sudoers \ && touch /usr/local/bin/kolla_neutron_extend_start \ && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_neutron_extend_start + +{% block neutron_base_footer %}{% endblock %} diff --git a/docker/neutron/neutron-dhcp-agent/Dockerfile.j2 b/docker/neutron/neutron-dhcp-agent/Dockerfile.j2 index 45eb8f737a..0f0ab4c7cb 100644 --- a/docker/neutron/neutron-dhcp-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-dhcp-agent/Dockerfile.j2 @@ -1,16 +1,22 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['ubuntu', 'debian'] %} {% if install_type == 'binary' %} -RUN apt-get -y install --no-install-recommends \ - neutron-dhcp-agent \ - && apt-get clean + {% set neutron_dhcp_agent_packages = [ + 'neutron-dhcp-agent' + ] %} + +{{ macros.install_packages(neutron_dhcp_agent_packages | customizable("packages")) }} {% endif %} {% endif %} +{% block neutron_dhcp_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-l3-agent/Dockerfile.j2 b/docker/neutron/neutron-l3-agent/Dockerfile.j2 index bf401540ef..cf069f4ab7 100644 --- a/docker/neutron/neutron-l3-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-l3-agent/Dockerfile.j2 @@ -1,30 +1,29 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - neutron-l3-agent \ - && apt-get clean + {% set neutron_l3_agent_packages = [ + 'neutron-l3-agent' + ] %} {% endif %} + {% elif install_type == 'source' %} - {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - keepalived \ - && yum clean all + {% set neutron_l3_agent_packages = [ + 'keepalived' + ] %} - {% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y install --no-install-recommends \ - keepalived \ - && apt-get clean - - {% endif %} {% endif %} +{{ macros.install_packages(neutron_l3_agent_packages | customizable("packages")) }} + +{% block neutron_l3_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-lbaas-agent/Dockerfile.j2 b/docker/neutron/neutron-lbaas-agent/Dockerfile.j2 index 5ad14ca995..dfda7ddd9e 100644 --- a/docker/neutron/neutron-lbaas-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-lbaas-agent/Dockerfile.j2 @@ -1,41 +1,32 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} -{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - haproxy \ - net-tools \ - && yum clean all - -{% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - haproxy \ - net-tools \ - && apt-get clean - -{% endif %} +{% set neutron_lbaas_agent_packages = [ + 'haproxy', + 'net-tools' +] %} +{{ macros.install_packages(neutron_lbaas_agent_packages | customizable("packages")) }} {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-neutron-lbaas \ - net-tools \ - && yum clean all + {% set neutron_lbaas_agent_packages = [ + 'openstack-neutron-lbaas' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - neutron-lbaas-common \ - neutron-lbaasv2-agent \ - python-neutron-lbaas \ - net-tools \ - && apt-get clean + {% set neutron_lbaas_agent_packages = [ + 'neutron-lbaas-common', + 'neutron-lbaasv2-agent', + 'python-neutron-lbaas' + ] %} {% endif %} +{{ macros.install_packages(neutron_lbaas_agent_packages | customizable("packages")) }} + {% elif install_type == 'source' %} ADD neutron-lbaas-agent-archive /neutron-lbaas-agent-source @@ -49,6 +40,8 @@ RUN ln -s neutron-lbaas-agent-source/* neutron_lbaas \ COPY extend_start.sh /usr/local/bin/kolla_neutron_extend_start RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start +{% block neutron_lbaas_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 index 2d968b6a87..c9323b536c 100644 --- a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 @@ -1,41 +1,38 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -# Install required packages -RUN yum -y install \ - ebtables \ - openstack-neutron-linuxbridge \ - && yum clean all + {% set neutron_linuxbridge_agent_packages = [ + 'ebtables', + 'openstack-neutron-linuxbridge' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - ebtables \ - neutron-plugin-linuxbridge-agent \ - && apt-get clean + {% set neutron_linuxbridge_agent_packages = [ + 'ebtables', + 'neutron-plugin-linuxbridge-agent' + ] %} {% endif %} + {% elif install_type == 'source' %} - {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -# Install required packages -RUN yum -y install \ - ebtables \ - bridge-utils \ - && yum clean all + {% set neutron_linuxbridge_agent_packages = [ + 'bridge-utils', + 'ebtables' + ] %} - {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install \ - ebtables \ - bridge-utils \ - && apt-get clean - - {% endif %} {% endif %} +{{ macros.install_packages(neutron_linuxbridge_agent_packages | customizable("packages")) }} + +{% block neutron_linuxbridge_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-metadata-agent/Dockerfile.j2 b/docker/neutron/neutron-metadata-agent/Dockerfile.j2 index 99c9c6feeb..748011c3f5 100644 --- a/docker/neutron/neutron-metadata-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-metadata-agent/Dockerfile.j2 @@ -1,16 +1,20 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['ubuntu', 'debian'] %} {% if install_type == 'binary' %} -RUN apt-get -y install --no-install-recommends \ - neutron-metadata-agent \ - && apt-get clean + {% set neutron_metadata_agent_packages = [ + 'neutron-metadata-agent' + ] %} {% endif %} {% endif %} +{{ macros.install_packages(neutron_metadata_agent_packages | customizable("packages")) }} + COPY neutron_sudoers /etc/sudoers.d/neutron_sudoers COPY extend_start.sh /usr/local/bin/kolla_neutron_extend_start RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start \ @@ -18,6 +22,8 @@ RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start \ && chmod 440 /etc/sudoers.d/neutron_sudoers \ && usermod -a -G kolla neutron +{% block neutron_metadata_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 index f943543d96..a89534846c 100644 --- a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 @@ -1,25 +1,30 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -# Install required packages -RUN yum -y install \ - openstack-neutron-openvswitch \ - openvswitch \ - && yum clean all + {% set neutron_openvswitch_agent_packages = [ + 'openstack-neutron-openvswitch', + 'openvswitch' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - openvswitch-switch \ - neutron-plugin-openvswitch-agent \ - && apt-get clean + {% set neutron_openvswitch_agent_packages = [ + 'neutron-plugin-openvswitch-agent', + 'openvswitch-switch' + ] %} {% endif %} {% endif %} +{{ macros.install_packages(neutron_openvswitch_agent_packages | customizable("packages")) }} + +{% block neutron_openvswitch_agent_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron diff --git a/docker/neutron/neutron-server/Dockerfile.j2 b/docker/neutron/neutron-server/Dockerfile.j2 index 18edabe129..07d31e83e0 100644 --- a/docker/neutron/neutron-server/Dockerfile.j2 +++ b/docker/neutron/neutron-server/Dockerfile.j2 @@ -1,23 +1,28 @@ FROM {{ namespace }}/{{ image_prefix }}neutron-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-neutron-lbaas \ - && yum clean all + {% set neutron_server_packages = [ + 'openstack-neutron-lbaas' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - neutron-lbaas-common \ - neutron-lbaasv2-agent \ - python-neutron-lbaas \ - && apt-get clean \ + {% set neutron_server_packages = [ + 'neutron-lbaas-common', + 'neutron-lbaasv2-agent', + 'python-neutron-lbaas' + ] %} + {% endif %} {% endif %} +{{ macros.install_packages(neutron_server_packages | customizable("packages")) }} + ADD plugins-archive / COPY extend_start.sh /usr/local/bin/kolla_neutron_extend_start RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start \ @@ -25,6 +30,8 @@ RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start \ pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /plugins/*; \ fi +{% block neutron_server_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER neutron