diff --git a/README.rst b/README.rst index ee0251def0..bdc12f68ff 100644 --- a/README.rst +++ b/README.rst @@ -32,6 +32,7 @@ Kolla provides images to deploy the following OpenStack projects: - `Bifrost `__ - `Ceilometer `__ - `Cinder `__ +- `CloudKitty `__ - `Congress `__ - `Designate `__ - `Glance `__ diff --git a/docker/cloudkitty/cloudkitty-api/Dockerfile.j2 b/docker/cloudkitty/cloudkitty-api/Dockerfile.j2 new file mode 100644 index 0000000000..cdbff832d4 --- /dev/null +++ b/docker/cloudkitty/cloudkitty-api/Dockerfile.j2 @@ -0,0 +1,20 @@ +FROM {{ namespace }}/{{ image_prefix }}cloudkitty-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_cloudkitty_extend_start +RUN chmod 755 /usr/local/bin/kolla_cloudkitty_extend_start + +{% block cloudkitty_api_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER cloudkitty diff --git a/docker/cloudkitty/cloudkitty-api/extend_start.sh b/docker/cloudkitty/cloudkitty-api/extend_start.sh new file mode 100644 index 0000000000..26d4a8c36d --- /dev/null +++ b/docker/cloudkitty/cloudkitty-api/extend_start.sh @@ -0,0 +1,9 @@ +#!/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 + cloudkitty-dbsync upgrade + cloudkitty-storage-init + exit 0 +fi diff --git a/docker/cloudkitty/cloudkitty-base/Dockerfile.j2 b/docker/cloudkitty/cloudkitty-base/Dockerfile.j2 new file mode 100644 index 0000000000..839d29b5af --- /dev/null +++ b/docker/cloudkitty/cloudkitty-base/Dockerfile.j2 @@ -0,0 +1,29 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% elif install_type == 'source' %} + +ADD cloudkitty-base-archive /cloudkitty-base-source +RUN ln -s cloudkitty-base-source/* cloudkitty \ + && useradd --user-group cloudkitty \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /cloudkitty \ + && mkdir -p /etc/cloudkitty /var/lib/cloudkitty /home/cloudkitty \ + && cp -r /cloudkitty/etc/cloudkitty/* /etc/cloudkitty/ \ + && chown -R cloudkitty: /etc/cloudkitty /var/lib/cloudkitty /home/cloudkitty + +{% endif %} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start + +RUN usermod -a -G kolla cloudkitty \ + && touch /usr/local/bin/kolla_cloudkitty_extend_start \ + && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_cloudkitty_extend_start + +{% block cloudkitty_base_footer %}{% endblock %} diff --git a/docker/cloudkitty/cloudkitty-base/extend_start.sh b/docker/cloudkitty/cloudkitty-base/extend_start.sh new file mode 100644 index 0000000000..cf49f9caf1 --- /dev/null +++ b/docker/cloudkitty/cloudkitty-base/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +if [[ ! -d "/var/log/kolla/cloudkitty" ]]; then + mkdir -p /var/log/kolla/cloudkitty +fi +if [[ $(stat -c %a /var/log/kolla/cloudkitty) != "755" ]]; then + chmod 755 /var/log/kolla/cloudkitty +fi + +. /usr/local/bin/kolla_cloudkitty_extend_start diff --git a/docker/cloudkitty/cloudkitty-processor/Dockerfile.j2 b/docker/cloudkitty/cloudkitty-processor/Dockerfile.j2 new file mode 100644 index 0000000000..0b0c0d250c --- /dev/null +++ b/docker/cloudkitty/cloudkitty-processor/Dockerfile.j2 @@ -0,0 +1,17 @@ +FROM {{ namespace }}/{{ image_prefix }}cloudkitty-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + +RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ + && /bin/false + +{% endif %} + +{% block cloudkitty_processor_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER cloudkitty diff --git a/kolla/common/config.py b/kolla/common/config.py index ba94f1f39c..25abbba75d 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -45,10 +45,10 @@ _PROFILE_OPTS = [ 'swift'], help='Main images'), cfg.ListOpt('aux', - default=['aodh', 'congress', 'designate', 'gnocchi', - 'influxdb', 'ironic', 'kuryr', 'magnum', 'manila', - 'mistral', 'murano', 'rally', 'sahara', 'senlin', - 'telegraf', 'trove', 'zaqar'], + default=['aodh', 'cloudkitty', 'congress', 'designate', + 'gnocchi', 'influxdb', 'ironic', 'kuryr', 'magnum', + 'manila', 'mistral', 'murano', 'rally', 'sahara', + 'senlin', 'telegraf', 'trove', 'zaqar'], help='Aux Images'), cfg.ListOpt('default', default=['cron', 'kolla-toolbox', 'glance', 'haproxy', @@ -189,6 +189,10 @@ SOURCES = { 'type': 'url', 'location': ('http://tarballs.openstack.org/congress/' 'congress-master.tar.gz')}, + 'cloudkitty-base': { + 'type': 'url', + 'location': ('http://tarballs.openstack.org/cloudkitty/' + 'cloudkitty-master.tar.gz')}, 'designate-base': { 'type': 'url', 'location': ('http://tarballs.openstack.org/designate/' diff --git a/releasenotes/notes/cloudkitty-docker-fb6b3d7e006a0697.yaml b/releasenotes/notes/cloudkitty-docker-fb6b3d7e006a0697.yaml new file mode 100644 index 0000000000..a6938d27f8 --- /dev/null +++ b/releasenotes/notes/cloudkitty-docker-fb6b3d7e006a0697.yaml @@ -0,0 +1,4 @@ +--- +features: + - Docker image for CloudKitty, the rating as a service component + of OpenStack. diff --git a/tests/test_build.py b/tests/test_build.py index 464cd19f75..86258b363b 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -71,7 +71,8 @@ class BuildTestCentosBinary(BuildTest, base.BaseTestCase): "vmtp", "watcher-base", "congress-base", - "bifrost-base"] + "bifrost-base", + "cloudkitty-base"] def setUp(self): super(BuildTestCentosBinary, self).setUp() @@ -96,7 +97,8 @@ class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): "zaqar", "watcher-base", "congress-base", - "bifrost-base"] + "bifrost-base", + "cloudkitty-base"] def setUp(self): super(BuildTestUbuntuBinary, self).setUp() @@ -120,7 +122,8 @@ class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): "vmtp", "watcher-base", "congress-base", - "bifrost-base"] + "bifrost-base", + "cloudkitty-base"] def setUp(self): super(BuildTestOracleLinuxBinary, self).setUp()