Add cyborg to kolla

Because kolla not have cyborg so should add this.

Implements: blueprint add-cyborg

Change-Id: I497e67e3a754fccfd2ef5a82f13ccfaf890a6fcd
This commit is contained in:
Bai Yongjun 2018-11-22 22:27:02 +08:00 committed by Taeha Kim
parent 09f37541d8
commit 265f643295
11 changed files with 181 additions and 0 deletions

View File

@ -80,6 +80,7 @@ Kolla provides images to deploy the following OpenStack projects:
- `Cinder <https://docs.openstack.org/cinder/latest/>`__ - `Cinder <https://docs.openstack.org/cinder/latest/>`__
- `CloudKitty <https://docs.openstack.org/cloudkitty/latest/>`__ - `CloudKitty <https://docs.openstack.org/cloudkitty/latest/>`__
- `Congress <https://docs.openstack.org/congress/latest/>`__ - `Congress <https://docs.openstack.org/congress/latest/>`__
- `Cyborg <https://docs.openstack.org/cyborg/latest/>`__
- `Designate <https://docs.openstack.org/designate/latest/>`__ - `Designate <https://docs.openstack.org/designate/latest/>`__
- `Dragonflow <https://docs.openstack.org/dragonflow/latest/>`__ - `Dragonflow <https://docs.openstack.org/dragonflow/latest/>`__
- `EC2-API <https://wiki.openstack.org/wiki/EC2API>`__ - `EC2-API <https://wiki.openstack.org/wiki/EC2API>`__

View File

@ -0,0 +1,46 @@
FROM {{ namespace }}/{{ image_prefix }}cyborg-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block cyborg_agent_header %}{% endblock %}
{% 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' %}
{% set cyborg_agent_pip_packages = [
'cursive'
] %}
{% endif %}
RUN {{ macros.install_pip(cyborg_agent_pip_packages | customizable("pip_packages")) }}
{% if base_package_type == 'rpm' %}
ENV opae_libs_rpm_url=https://github.com/OPAE/opae-sdk/releases/download/1.1.0-2/opae-libs-1.1.0-2.x86_64.rpm
ENV opae_libs_rpm_sha1sum=3a10f80d64be46bb8d99ba88548646d0e368a06e
ENV opae_devel_rpm_url=https://github.com/OPAE/opae-sdk/releases/download/1.1.0-2/opae-devel-1.1.0-2.x86_64.rpm
ENV opae_devel_rpm_sha1sum=461356b987b41843f60123d66195620bf1e4e28e
RUN curl -sSL -o /tmp/opae-libs.rpm ${opae_libs_rpm_url} \
&& echo "${opae_libs_rpm_sha1sum} /tmp/opae-libs.rpm" | sha1sum -c \
&& curl -sSL -o /tmp/opae-devel.rpm ${opae_devel_rpm_url} \
&& echo "${opae_devel_rpm_sha1sum} /tmp/opae-devel.rpm" | sha1sum -c \
&& yum -y install /tmp/opae-libs.rpm /tmp/opae-devel.rpm \
&& rm -f /tmp/opae-libs.rpm /tmp/opae-devel.rpm
# NOTE(Bai Yongjun) Required packages are only supported Ubuntu16.04
# Please check the details:https://github.com/OPAE/opae-sdk/releases/tag/1.1.0-2
{% elif base_package_type == 'deb' %}
RUN echo 'No supported packages' \
&& /bin/false
{% endif %}
{% block cyborg_agent_footer %}{% endblock %}
{% block footer %}{% endblock %}

View File

@ -0,0 +1,42 @@
FROM {{ namespace }}/{{ image_prefix }}cyborg-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block cyborg_api_header %}{% endblock %}
{% 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' %}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
{% set cyborg_api_packages = [
'mod_ssl',
'mod_wsgi'
] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set cyborg_api_packages = [
'apache2',
'libapache2-mod-wsgi'
] %}
{% endif %}
{% endif %}
{{ macros.install_packages(cyborg_api_packages | customizable("packages")) }}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] %}
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'] %}
RUN echo > /etc/apache2/ports.conf
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_cyborg_extend_start
RUN chmod 755 /usr/local/bin/kolla_cyborg_extend_start
{% block cyborg_api_footer %}{% endblock %}
{% block footer %}{% endblock %}

View File

@ -0,0 +1,16 @@
#!/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
cyborg-dbsync
exit 0
fi
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

View File

@ -0,0 +1,36 @@
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block cyborg_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='cyborg') }}
{% if install_type == 'binary' %}
RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
&& /bin/false
{% elif install_type == 'source' %}
ADD cyborg-base-archive /cyborg-base-source
{% set cyborg_base_pip_packages = [
'/cyborg'
] %}
RUN ln -s cyborg-base-source/* cyborg \
&& {{ macros.install_pip(cyborg_base_pip_packages | customizable("pip_packages")) }}
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
COPY cyborg_sudoers /etc/sudoers.d/kolla_cyborg_sudoers
RUN chmod 750 /etc/sudoers.d \
&& touch /usr/local/bin/kolla_cyborg_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_cyborg_extend_start
{% block cyborg_footer %}{% endblock %}
{% block footer %}{% endblock %}

View File

@ -0,0 +1 @@
%kolla ALL=(root) NOPASSWD: /usr/bin/chown -R cyborg\: /var/lib/cyborg/, /bin/chown -R cyborg\: /var/lib/cyborg/

View File

@ -0,0 +1,15 @@
#!/bin/bash
# Create log dir for Cyborg logs
CYBORG_LOG_DIR="/var/log/kolla/cyborg"
if [[ ! -d "${CYBORG_LOG_DIR}" ]]; then
mkdir -p ${CYBORG_LOG_DIR}
fi
if [[ $(stat -c %U:%G ${CYBORG_LOG_DIR}) != "cyborg:kolla" ]]; then
chown cyborg:kolla ${CYBORG_LOG_DIR}
fi
if [[ $(stat -c %a ${CYBORG_LOG_DIR}) != "755" ]]; then
chmod 755 ${CYBORG_LOG_DIR}
fi
. /usr/local/bin/kolla_cyborg_extend_start

View File

@ -0,0 +1,7 @@
FROM {{ namespace }}/{{ image_prefix }}cyborg-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block cyborg_conductor_header %}{% endblock %}
{% block cyborg_conductor_footer %}{% endblock %}
{% block footer %}{% endblock %}

View File

@ -338,6 +338,10 @@ SOURCES = {
'type': 'git', 'type': 'git',
'reference': 'master', 'reference': 'master',
'location': ('https://github.com/pulp/crane.git')}, 'location': ('https://github.com/pulp/crane.git')},
'cyborg-base': {
'type': 'url',
'location': ('$tarballs_base/cyborg/'
'cyborg-master.tar.gz')},
'designate-base': { 'designate-base': {
'type': 'url', 'type': 'url',
'location': ('$tarballs_base/designate/' 'location': ('$tarballs_base/designate/'
@ -1177,6 +1181,10 @@ USERS = {
'placement-user': { 'placement-user': {
'uid': 42482, 'uid': 42482,
'gid': 42482, 'gid': 42482,
},
'cyborg-user': {
'uid': 42483,
'gid': 42483,
} }
} }

View File

@ -82,6 +82,7 @@ SKIPPED_IMAGES = {
"almanach-base", "almanach-base",
"bifrost-base", "bifrost-base",
"blazar-base", "blazar-base",
"cyborg-base",
"dragonflow-base", "dragonflow-base",
"freezer-base", "freezer-base",
"karbor-base", "karbor-base",
@ -109,6 +110,7 @@ SKIPPED_IMAGES = {
"cloudkitty-base", "cloudkitty-base",
"congress-base", "congress-base",
"crane", "crane",
"cyborg-base",
"dragonflow-base", "dragonflow-base",
"ec2-api", "ec2-api",
"freezer-base", "freezer-base",
@ -136,6 +138,7 @@ SKIPPED_IMAGES = {
], ],
'ubuntu+source': [ 'ubuntu+source': [
"crane", "crane",
"cyborg-base",
# There is no qdrouterd package for ubuntu bionic # There is no qdrouterd package for ubuntu bionic
"qdrouterd", "qdrouterd",
"tripleoclient", "tripleoclient",
@ -150,6 +153,7 @@ SKIPPED_IMAGES = {
"cloudkitty-base", "cloudkitty-base",
"congress-base", "congress-base",
"crane", "crane",
"cyborg-base",
"dragonflow-base", "dragonflow-base",
"ec2-api", "ec2-api",
"freezer-base", "freezer-base",
@ -176,6 +180,7 @@ SKIPPED_IMAGES = {
], ],
'debian+source': [ 'debian+source': [
"crane", "crane",
"cyborg-base",
"sensu-base", "sensu-base",
"tripleoclient", "tripleoclient",
"tripleo-ui" "tripleo-ui"
@ -185,6 +190,7 @@ SKIPPED_IMAGES = {
"bifrost-base", "bifrost-base",
"blazar-base", "blazar-base",
"crane", "crane",
"cyborg-base",
"dragonflow-base", "dragonflow-base",
"freezer-base", "freezer-base",
"karbor-base", "karbor-base",

View File

@ -0,0 +1,3 @@
---
features:
- Cyborg Docker images are available in Kolla