From b597c90827ff0be7d21d394829e3067b4bcca28d Mon Sep 17 00:00:00 2001 From: Shaun Smekel Date: Fri, 12 Aug 2016 08:16:11 +1000 Subject: [PATCH] Customizations for Ironic This patchset contains customization of Dockerfile of Ironic containers. Change-Id: If6ffb741111127886f754ddebd17059174387fc8 Partially-implements: blueprint third-party-plugin-support --- docker/ironic/ironic-api/Dockerfile.j2 | 18 ++++---- docker/ironic/ironic-base/Dockerfile.j2 | 19 ++++---- docker/ironic/ironic-conductor/Dockerfile.j2 | 47 +++++++++----------- docker/ironic/ironic-inspector/Dockerfile.j2 | 12 ++--- docker/ironic/ironic-pxe/Dockerfile.j2 | 27 +++++------ 5 files changed, 60 insertions(+), 63 deletions(-) diff --git a/docker/ironic/ironic-api/Dockerfile.j2 b/docker/ironic/ironic-api/Dockerfile.j2 index 426e8674d7..7325051a51 100644 --- a/docker/ironic/ironic-api/Dockerfile.j2 +++ b/docker/ironic/ironic-api/Dockerfile.j2 @@ -1,25 +1,23 @@ FROM {{ namespace }}/{{ image_prefix }}ironic-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-ironic-api \ - && yum clean all - + {% set ironic_api_packages = ['openstack-ironic-api'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - ironic-api \ - && apt-get clean - + {% set ironic_api_packages = ['ironic-api'] %} {% endif %} + +{{ macros.install_packages(ironic_api_packages | customizable("packages")) }} + {% endif %} COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block ironic_api_footer %}{% endblock %} {{ include_footer }} USER ironic diff --git a/docker/ironic/ironic-base/Dockerfile.j2 b/docker/ironic/ironic-base/Dockerfile.j2 index a732ca479e..ca45f13a16 100644 --- a/docker/ironic/ironic-base/Dockerfile.j2 +++ b/docker/ironic/ironic-base/Dockerfile.j2 @@ -1,20 +1,17 @@ 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-ironic-common \ - && yum clean all - + {% set ironic_base_packages = ['openstack-ironic-common'] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - ironic-common \ - && apt-get clean - + {% set ironic_base_packages = ['ironic-common'] %} {% endif %} + +{{ macros.install_packages(ironic_base_packages | customizable("packages")) }} + {% elif install_type == 'source' %} ADD ironic-base-archive /ironic-base-source @@ -30,3 +27,5 @@ RUN ln -s ironic-base-source/* ironic \ RUN usermod -a -G kolla ironic \ && chown -R ironic: /etc/ironic + +{% block ironic_base_footer %}{% endblock %} diff --git a/docker/ironic/ironic-conductor/Dockerfile.j2 b/docker/ironic/ironic-conductor/Dockerfile.j2 index ea26296e3d..4448260995 100644 --- a/docker/ironic/ironic-conductor/Dockerfile.j2 +++ b/docker/ironic/ironic-conductor/Dockerfile.j2 @@ -1,41 +1,38 @@ FROM {{ namespace }}/{{ image_prefix }}ironic-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-ironic-conductor \ - qemu-img \ - && yum clean all - + {% set ironic_conductor_packages = [ + 'openstack-ironic-conductor', + 'qemu-img' + ] %} {% elif base_distro in ['ubuntu'] %} - -RUN apt-get -y install --no-install-recommends \ - ironic-conductor \ - qemu-utils \ - ipmitool \ - && apt-get clean - + {% set ironic_conductor_packages = [ + 'ironic-conductor', + 'qemu-utils', + 'ipmitool' + ] %} {% endif %} {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - qemu-img \ - ipmitool \ - && yum clean all - + {% set ironic_conductor_packages = [ + 'qemu-img', + 'ipmitool' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y install --no-install-recommends \ - qemu-utils \ - ipmitool \ - && apt-get clean - + {% set ironic_conductor_packages = [ + 'qemu-utils', + 'ipmitool' + ] %} {% endif %} {% endif %} +{{ macros.install_packages(ironic_conductor_packages | customizable("packages")) }} + +{% block ironic_conductor_footer %}{% endblock %} {{ include_footer }} USER ironic diff --git a/docker/ironic/ironic-inspector/Dockerfile.j2 b/docker/ironic/ironic-inspector/Dockerfile.j2 index 217a73e06c..d3ea30786d 100644 --- a/docker/ironic/ironic-inspector/Dockerfile.j2 +++ b/docker/ironic/ironic-inspector/Dockerfile.j2 @@ -1,16 +1,18 @@ FROM {{ namespace }}/{{ image_prefix }}ironic-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-ironic-inspector \ - && yum clean all - + {% set ironic_inspector_packages = ['openstack-ironic-inspector'] %} {% endif %} + +{{ macros.install_packages(ironic_inspector_packages | customizable("packages")) }} + {% endif %} +{% block ironic_inspector_footer %}{% endblock %} {{ include_footer }} USER ironic diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2 index 317acc65ea..6a4b13b9d8 100644 --- a/docker/ironic/ironic-pxe/Dockerfile.j2 +++ b/docker/ironic/ironic-pxe/Dockerfile.j2 @@ -1,25 +1,26 @@ FROM {{ namespace }}/{{ image_prefix }}ironic-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} - -RUN yum -y install \ - tftp-server \ - syslinux-tftpboot \ - && yum clean all - + {% set ironic_pxe_packages = [ + 'tftp-server', + 'syslinux-tftpboot' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} - -RUN apt-get -y install --no-install-recommends \ - tftpd-hpa \ - syslinux-common \ - syslinux \ - && apt-get clean - + {% set ironic_pxe_packages = [ + 'tftpd-hpa', + 'syslinux-common', + 'syslinux' + ] %} {% endif %} +{{ macros.install_packages(ironic_pxe_packages | customizable("packages")) }} + COPY tftp-map-file /map-file COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block ironic_pxe_footer %}{% endblock %} {{ include_footer }}