Split placement-api from nova

This change breaks out the Placement service from Nova ahead of it's
removal from the project later in Stein.

For the time being the original Nova Placement images are left in place
but they will be removed later in the cycle once the Placement code is
removed from the Nova project by the following change:

https://review.openstack.org/#/c/618215/

Co-Authored-By: Lee Yarwood <lyarwood@redhat.com>
Change-Id: I2bf6f5bf45b76e6900f41c21e9af30c69dc6e9c0
changes/89/613589/13
Eduardo Gonzalez 4 years ago committed by Lee Yarwood
parent 772b525722
commit 2f657085c6

@ -0,0 +1,62 @@
FROM {{ namespace }}/{{ image_prefix }}placement-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block placement_api_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set placement_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi',
'openstack-placement-api'
] %}
{{ macros.install_packages(placement_api_packages | customizable("packages")) }}
RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
&& sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set placement_api_packages = [
'apache2',
'libapache2-mod-wsgi',
'placement-api'
] %}
{{ macros.install_packages(placement_api_packages | customizable("packages")) }}
RUN truncate -s 0 /etc/apache2/ports.conf
{% endif %}
{% elif install_type == 'source' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set placement_api_packages = [
'httpd',
'mod_ssl',
'mod_wsgi'
] %}
{{ macros.install_packages(placement_api_packages | customizable("packages")) }}
RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
&& sed -i -r 's,^(Listen 443),#\1,' /etc/httpd/conf.d/ssl.conf
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set placement_api_packages = [
'apache2',
'libapache2-mod-wsgi'
] %}
{{ macros.install_packages(placement_api_packages | customizable("packages")) }}
RUN truncate -s 0 /etc/apache2/ports.conf
{% endif %}
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_placement_extend_start
{% block placement_api_footer %}{% endblock %}
{% block footer %}{% endblock %}

@ -0,0 +1,18 @@
#!/bin/bash
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
placement-manage db sync
exit 0
fi
# NOTE(pbourke): httpd will not clean up after itself in some cases which
# results in the container not being able to restart. (bug #1489676, 1557036)
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
# Loading Apache2 ENV variables
. /etc/apache2/envvars
rm -rf /var/run/apache2/*
else
rm -rf /var/run/httpd/* /run/httpd/* /tmp/httpd*
fi

@ -0,0 +1,47 @@
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block placement_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='placement') }}
{% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set placement_base_packages = [
'openstack-placement-common',
] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set placement_base_packages = [] %}
{% endif %}
{{ macros.install_packages(placement_base_packages | customizable("packages")) }}
{% elif install_type == 'source' %}
ADD placement-base-archive /placement-base-source
ADD plugins-archive /
{% set placement_base_pip_packages = [
'/placement'
] %}
RUN ln -s placement-base-source/* placement \
&& {{ macros.install_pip(placement_base_pip_packages | customizable("pip_packages")) }} \
&& mkdir -p /etc/placement/ \
&& cp -r /placement/etc/placement/* /etc/placement/ \
&& chown -R placement: /etc/placement/
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN touch /usr/local/bin/kolla_placement_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_placement_extend_start
{% block placement_base_footer %}{% endblock %}

@ -0,0 +1,12 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/placement" ]]; then
mkdir -p /var/log/kolla/placement
touch /var/log/kolla/placement/placement-api.log
fi
if [[ $(stat -c %a /var/log/kolla/placement) != "755" ]]; then
chmod 755 /var/log/kolla/placement
chmod 644 /var/log/kolla/placement/placement-api.log
fi
. /usr/local/bin/kolla_placement_extend_start

@ -657,6 +657,10 @@ SOURCES = {
'type': 'url',
'location': ('$tarballs_base/panko/'
'panko-master.tar.gz')},
'placement-base': {
'type': 'url',
'location': ('$tarballs_base/placement/'
'placement-master.tar.gz')},
'tempest-plugin-tempest-conf': {
'type': 'url',
'location': ('$tarballs_base/python-tempestconf/'
@ -1135,6 +1139,10 @@ USERS = {
'uid': 42481, # unused user, but we need the group for thales hsm
'gid': 42481,
},
'placement-user': {
'uid': 42482,
'gid': 42482,
}
}

@ -121,6 +121,7 @@ SKIPPED_IMAGES = {
"nova-mksproxy",
"novajoin-base",
"octavia-base",
"placement-base",
# There is no qdrouterd package for ubuntu bionic
"qdrouterd",
"searchlight-base",

@ -0,0 +1,7 @@
---
features:
- |
Nova placement API has been moved into its own images.
upgrade:
- |
nova-placement-api image will be renamed to placement-api.
Loading…
Cancel
Save