From e0f0e2105f57c88c1d78ba61f773c873b40c18d0 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Wed, 19 Aug 2015 15:59:06 -0400 Subject: [PATCH] Add templated dockerfiles for ironic Partially-implements: blueprint ironic-container Change-Id: I7869c49c851a95c12fffaf426abd6625f3f1a212 --- .../ironic/ironic-api/Dockerfile.j2 | 17 +++++++++++ .../ironic/ironic-api/config-external.sh | 11 ++++++++ docker_templates/ironic/ironic-api/start.sh | 10 +++++++ .../ironic/ironic-base/Dockerfile.j2 | 28 +++++++++++++++++++ .../ironic/ironic-conductor/Dockerfile.j2 | 17 +++++++++++ .../ironic-conductor/config-external.sh | 11 ++++++++ .../ironic/ironic-conductor/start.sh | 10 +++++++ .../ironic/ironic-discoverd/Dockerfile.j2 | 17 +++++++++++ .../ironic-discoverd/config-external.sh | 11 ++++++++ .../ironic/ironic-discoverd/start.sh | 10 +++++++ 10 files changed, 142 insertions(+) create mode 100644 docker_templates/ironic/ironic-api/Dockerfile.j2 create mode 100644 docker_templates/ironic/ironic-api/config-external.sh create mode 100755 docker_templates/ironic/ironic-api/start.sh create mode 100644 docker_templates/ironic/ironic-base/Dockerfile.j2 create mode 100644 docker_templates/ironic/ironic-conductor/Dockerfile.j2 create mode 100644 docker_templates/ironic/ironic-conductor/config-external.sh create mode 100755 docker_templates/ironic/ironic-conductor/start.sh create mode 100644 docker_templates/ironic/ironic-discoverd/Dockerfile.j2 create mode 100644 docker_templates/ironic/ironic-discoverd/config-external.sh create mode 100755 docker_templates/ironic/ironic-discoverd/start.sh diff --git a/docker_templates/ironic/ironic-api/Dockerfile.j2 b/docker_templates/ironic/ironic-api/Dockerfile.j2 new file mode 100644 index 0000000000..3aa2322ef7 --- /dev/null +++ b/docker_templates/ironic/ironic-api/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-ironic-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if install_type == 'binary' %} + {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +RUN yum -y install \ + openstack-ironic-api \ + && yum clean all + + {% endif %} +{% endif %} + +COPY start.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker_templates/ironic/ironic-api/config-external.sh b/docker_templates/ironic/ironic-api/config-external.sh new file mode 100644 index 0000000000..b838ee19d0 --- /dev/null +++ b/docker_templates/ironic/ironic-api/config-external.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SOURCE="/opt/kolla/ironic-api/ironic.conf" +TARGET="/etc/ironic/ironic.conf" +OWNER="ironic" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker_templates/ironic/ironic-api/start.sh b/docker_templates/ironic/ironic-api/start.sh new file mode 100755 index 0000000000..9d449defbe --- /dev/null +++ b/docker_templates/ironic/ironic-api/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/ironic-api" +ARGS="" + +source /opt/kolla/kolla-common.sh +set_configs + +exec $CMD $ARGS diff --git a/docker_templates/ironic/ironic-base/Dockerfile.j2 b/docker_templates/ironic/ironic-base/Dockerfile.j2 new file mode 100644 index 0000000000..02e00f4093 --- /dev/null +++ b/docker_templates/ironic/ironic-base/Dockerfile.j2 @@ -0,0 +1,28 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if install_type == 'binary' %} + {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +# until packaging is fixed, all of this is required +# api: policy +# conductor:MySQL-python +RUN yum -y install \ + python-oslo-log \ + python-oslo-concurrency \ + python-oslo-policy \ + MySQL-python \ + && yum clean all + + {% elif base_distro in ['ubuntu', 'debian'] %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + + {% endif %} +{% elif install_type == 'source' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} diff --git a/docker_templates/ironic/ironic-conductor/Dockerfile.j2 b/docker_templates/ironic/ironic-conductor/Dockerfile.j2 new file mode 100644 index 0000000000..65c816d62c --- /dev/null +++ b/docker_templates/ironic/ironic-conductor/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-ironic-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if install_type == 'binary' %} + {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +RUN yum -y install \ + openstack-ironic-conductor \ + && yum clean all + + {% endif %} +{% endif %} + +COPY start.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker_templates/ironic/ironic-conductor/config-external.sh b/docker_templates/ironic/ironic-conductor/config-external.sh new file mode 100644 index 0000000000..b838ee19d0 --- /dev/null +++ b/docker_templates/ironic/ironic-conductor/config-external.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SOURCE="/opt/kolla/ironic-api/ironic.conf" +TARGET="/etc/ironic/ironic.conf" +OWNER="ironic" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker_templates/ironic/ironic-conductor/start.sh b/docker_templates/ironic/ironic-conductor/start.sh new file mode 100755 index 0000000000..c766f04c5b --- /dev/null +++ b/docker_templates/ironic/ironic-conductor/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/ironic-conductor" +ARGS="" + +source /opt/kolla/kolla-common.sh +set_configs + +exec $CMD $ARGS diff --git a/docker_templates/ironic/ironic-discoverd/Dockerfile.j2 b/docker_templates/ironic/ironic-discoverd/Dockerfile.j2 new file mode 100644 index 0000000000..6de58d8610 --- /dev/null +++ b/docker_templates/ironic/ironic-discoverd/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-ironic-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if install_type == 'binary' %} + {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +RUN yum -y install \ + openstack-ironic-discoverd \ + && yum clean all + + {% endif %} +{% endif %} + +COPY start.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] diff --git a/docker_templates/ironic/ironic-discoverd/config-external.sh b/docker_templates/ironic/ironic-discoverd/config-external.sh new file mode 100644 index 0000000000..a3f82b8f30 --- /dev/null +++ b/docker_templates/ironic/ironic-discoverd/config-external.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SOURCE="/opt/kolla/ironic-discoverd/discoverd.conf" +TARGET="/etc/ironic-discoverd/discoverd.conf" +OWNER="ironic" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker_templates/ironic/ironic-discoverd/start.sh b/docker_templates/ironic/ironic-discoverd/start.sh new file mode 100755 index 0000000000..093dc517af --- /dev/null +++ b/docker_templates/ironic/ironic-discoverd/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/bin/ironic-discoverd" +ARGS="" + +source /opt/kolla/kolla-common.sh +set_configs + +exec $CMD $ARGS