diff options
| author | Sean Mooney <sean.k.mooney@intel.com> | 2016-05-10 12:17:37 +0100 |
|---|---|---|
| committer | Sean Mooney <sean.k.mooney@intel.com> | 2016-08-31 09:24:24 +0000 |
| commit | a9e16c8bdefbc4a7c4869b8087a2a3a6f3246914 (patch) | |
| tree | 63021a3d3e34437787bb6939a2e9b8cbf0d3aa47 /docker/bifrost | |
| parent | a409b1a03db67b5587214759963687e7c0a6258e (diff) | |
| download | kolla-a9e16c8bdefbc4a7c4869b8087a2a3a6f3246914.tar.gz kolla-a9e16c8bdefbc4a7c4869b8087a2a3a6f3246914.zip | |
introduce bifrost-deploy container
- This change adds support for building and deploying
a bifrost container for baremetal provisioning.
- This change documents how to manually deploy and bootstrap
the bifrost container.
Implements: blueprint bifrost-support
Change-Id: I7d895839b11cbf916be33225875465c3358b5aa4
Diffstat (limited to 'docker/bifrost')
| -rw-r--r-- | docker/bifrost/bifrost-base/Dockerfile.j2 | 42 | ||||
| -rw-r--r-- | docker/bifrost/bifrost-base/bifrost_sudoers | 1 | ||||
| -rw-r--r-- | docker/bifrost/bifrost-base/build_arg.yml | 4 | ||||
| -rw-r--r-- | docker/bifrost/bifrost-deploy/Dockerfile.j2 | 58 | ||||
| -rw-r--r-- | docker/bifrost/bifrost-deploy/init-fake.conf | 14 |
5 files changed, 119 insertions, 0 deletions
diff --git a/docker/bifrost/bifrost-base/Dockerfile.j2 b/docker/bifrost/bifrost-base/Dockerfile.j2 new file mode 100644 index 000000000..661688017 --- /dev/null +++ b/docker/bifrost/bifrost-base/Dockerfile.j2 @@ -0,0 +1,42 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' && /bin/false + +{% elif install_type == 'source' %} +ADD bifrost-base-archive /bifrost-base-source +COPY build_arg.yml /tmp/build_arg.yml +RUN ln -s bifrost-base-source/* bifrost \ + && useradd --user-group bifrost \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /bifrost + +WORKDIR /bifrost + +{% if base_distro in ['ubuntu', 'debian'] %} +RUN sed -e "s/.*mariadb.*//Ig" -i /etc/apt/sources.list && apt-get purge -y mariadb* mysql* +{% endif %} + + +RUN bash -c './scripts/env-setup.sh && source ./env-vars && source /opt/stack/ansible/hacking/env-setup && \ + ansible-playbook -vvvv -i /bifrost/playbooks/inventory/localhost /bifrost/playbooks/install.yaml \ + -e @/tmp/build_arg.yml && \ +{% if base_distro in ['ubuntu', 'debian'] %} + apt-get clean' +{% else %} + yum clean all' +{% endif %} + + +{% endif %} + + +COPY bifrost_sudoers /etc/sudoers.d/bifrost_sudoers + +RUN usermod -a -G kolla bifrost \ + && chmod 750 /etc/sudoers.d \ + && chmod 440 /etc/sudoers.d/bifrost_sudoers \ + && chown -R bifrost:bifrost /bifrost + +{% block bifrost_base_footer %}{% endblock %} diff --git a/docker/bifrost/bifrost-base/bifrost_sudoers b/docker/bifrost/bifrost-base/bifrost_sudoers new file mode 100644 index 000000000..6c343a956 --- /dev/null +++ b/docker/bifrost/bifrost-base/bifrost_sudoers @@ -0,0 +1 @@ +bifrost ALL=(ALL) NOPASSWD:ALL diff --git a/docker/bifrost/bifrost-base/build_arg.yml b/docker/bifrost/bifrost-base/build_arg.yml new file mode 100644 index 000000000..c069fc2a3 --- /dev/null +++ b/docker/bifrost/bifrost-base/build_arg.yml @@ -0,0 +1,4 @@ +skip_bootstrap: true +skip_start: true +install_dib: true +create_image_via_dib: false diff --git a/docker/bifrost/bifrost-deploy/Dockerfile.j2 b/docker/bifrost/bifrost-deploy/Dockerfile.j2 new file mode 100644 index 000000000..2f4149ea7 --- /dev/null +++ b/docker/bifrost/bifrost-deploy/Dockerfile.j2 @@ -0,0 +1,58 @@ +FROM {{ namespace }}/{{ image_prefix }}bifrost-base:{{ tag }} +MAINTAINER {{ maintainer }} +ENV container docker + +{% import "macros.j2" as macros with context %} + +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel', 'debian'] or (base_distro == 'ubuntu' and base_distro_tag == '16.04') %} + +RUN bash -c ' $(cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ \"$i\" == \"systemd-tmpfiles-setup.service\" ] || rm -f $i; done); \ +rm -f /lib/systemd/system/multi-user.target.wants/*;\ +rm -f /etc/systemd/system/*.wants/*;\ +rm -f /lib/systemd/system/local-fs.target.wants/*; \ +rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ +rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ +rm -f /lib/systemd/system/basic.target.wants/*;\ +rm -f /lib/systemd/system/anaconda.target.wants/*;' + +{% elif base_distro in ['ubuntu'] %} + +# derived from https://raw.githubusercontent.com/tianon/dockerfiles/4d24a12b54b75b3e0904d8a285900d88d3326361/sbin-init/ubuntu/upstart/14.04/Dockerfile +ADD init-fake.conf /etc/init/fake-container-events.conf + +# undo some leet hax of the base image +RUN rm /usr/sbin/policy-rc.d; \ + rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl + +# remove some pointless services +RUN /usr/sbin/update-rc.d -f ondemand remove; \ + for f in \ + /etc/init/u*.conf \ + /etc/init/mounted-dev.conf \ + /etc/init/mounted-proc.conf \ + /etc/init/mounted-run.conf \ + /etc/init/mounted-tmp.conf \ + /etc/init/mounted-var.conf \ + /etc/init/hostname.conf \ + /etc/init/networking.conf \ + /etc/init/tty*.conf \ + /etc/init/plymouth*.conf \ + /etc/init/hwclock*.conf \ + /etc/init/module*.conf\ + ; do \ + dpkg-divert --local --rename --add "$f"; \ + done; \ + echo '# /lib/init/fstab: cleared out for bare-bones Docker' > /lib/init/fstab +{% endif %} + +{% set bifrost_deploy_packages = [ + 'e2fsprogs' +] %} + +{{ macros.install_packages(bifrost_deploy_packages | customizable("packages")) }} + +CMD [ "/sbin/init" ] + +{% block bifrost_deploy_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} diff --git a/docker/bifrost/bifrost-deploy/init-fake.conf b/docker/bifrost/bifrost-deploy/init-fake.conf new file mode 100644 index 000000000..00a8f8ccd --- /dev/null +++ b/docker/bifrost/bifrost-deploy/init-fake.conf @@ -0,0 +1,14 @@ +# copied from https://github.com/tianon/dockerfiles/blob/4d24a12b54b75b3e0904d8a285900d88d3326361/sbin-init/ubuntu/upstart/14.04/init-fake.conf +# fake some events needed for correct startup other services + +description "In-Container Upstart Fake Events" + +start on startup + +script + rm -rf /var/run/*.pid + rm -rf /var/run/network/* + /sbin/initctl emit stopped JOB=udevtrigger --no-wait + /sbin/initctl emit started JOB=udev --no-wait + /sbin/initctl emit runlevel RUNLEVEL=3 --no-wait +end script |
