Add Magnum Containers as a Service to Kolla

This adds Magnum Containers as a Service to Kolla.

Change-Id: I572cd62845515f42a6a16291d2bd87ad8d972e24
Implements-blueprint: container-magnum
This commit is contained in:
Steven Dake 2015-05-02 20:36:27 -07:00
parent 56e72a6bcf
commit 5a06901664
15 changed files with 176 additions and 0 deletions

View File

@ -45,6 +45,7 @@ services:
* Ceilometer
* Horizon
* Zaqar
* Magnum
```
$ sudo docker search kollaglue

View File

@ -0,0 +1,14 @@
magnumapi:
image: kollaglue/centos-rdo-magnum-api:kilo
name: magnum-api
net: "host"
restart: always
env_file:
- openstack.env
magnumconductor:
image: kollaglue/centos-rdo-magnum-conductor:kilo
name: magnum-conductor
net: "host"
restart: always
env_file:
- openstack.env

View File

@ -0,0 +1,11 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%magnum-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \
openstack-magnum-api \
&& yum clean all
ADD ./start.sh /start.sh
ADD ./check.sh /check.sh
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../tools/build-docker-image

View File

@ -0,0 +1,16 @@
#!/bin/bash
RES=0
. /openrc
if ! keystone token-get > /dev/null; then
echo "ERROR: keystone token-get failed" >&2
RES=1
else
if ! heat stack-list > /dev/null; then
echo "ERROR: heat stack-list failed" >&2
RES=1
fi
fi
exit $RES

View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-magnum.sh
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
MAGNUM_KEYSTONE_USER MAGNUM_KEYSTONE_PASSWORD \
KEYSTONE_AUTH_PROTOCOL ADMIN_TENANT_NAME \
MAGNUM_API_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_PORT \
MAGNUM_API_SERVICE_PORT
fail_unless_os_service_running keystone
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
crux user-create -n ${MAGNUM_KEYSTONE_USER} \
-p ${MAGNUM_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${MAGNUM_KEYSTONE_USER} -t container \
-I "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${MAGNUM_API_SERVICE_HOST}:${MAGNUM_API_SERVICE_PORT}/v1"
exec /usr/bin/magnum-api

View File

@ -0,0 +1,9 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
# Magnum is not yet in upstream RDO packaging
RUN curl https://copr.fedoraproject.org/coprs/sdake/openstack-magnum/repo/epel-7/sdake-openstack-magnum-epel-7.repo -o /etc/yum.repos.d/sdake-openstack-magnum-epel-7.repo
RUN mkdir -p /opt/kolla
COPY config-magnum.sh /opt/kolla/config-magnum.sh

View File

@ -0,0 +1 @@
../../../tools/build-docker-image

View File

@ -0,0 +1,46 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
check_required_vars MAGNUM_DB_PASSWORD MAGNUM_KEYSTONE_PASSWORD \
KEYSTONE_PUBLIC_SERVICE_HOST KEYSTONE_PUBLIC_SERVICE_PORT \
MAGNUM_KEYSTONE_USER ADMIN_TENANT_NAME \
MAGNUM_DB_USER MAGNUM_DB_NAME KEYSTONE_AUTH_PROTOCOL \
KEYSTONE_PUBLIC_SERVICE_PORT RABBITMQ_SERVICE_HOST \
VERBOSE_LOGGING DEBUG_LOGGING
fail_unless_db
dump_vars
cat > /openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
export OS_USERNAME="${MAGNUM_KEYSTONE_USER}"
export OS_PASSWORD="${MAGNUM_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF
cfg=/etc/magnum/magnum.conf
crudini --set $cfg DEFAULT log_file ""
crudini --set $cfg DEFAULT verbose "${VERBOSE_LOGGING}"
crudini --set $cfg DEFAULT debug "${DEBUG_LOGGING}"
crudini --set $cfg DEFAULT use_stderr true
crudini --set $cfg DEFAULT rpc_backend magnum.openstack.common.rpc.impl_kombu
crudini --set $cfg DEFAULT admin_user admin
crudini --set $cfg oslo_messaging_rabbit rabbit_host ${RABBITMQ_SERVICE_HOST}
crudini --set $cfg oslo_messaging_rabbit rabbit_userid ${RABBIT_USER}
crudini --set $cfg oslo_messaging_rabbit rabbit_password ${RABBIT_PASSWORD}
crudini --set $cfg database connection \
mysql://${MAGNUM_DB_USER}:${MAGNUM_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${MAGNUM_DB_NAME}
crudini --set $cfg keystone_authtoken auth_protocol "${KEYSTONE_AUTH_PROTOCOL}"
crudini --set $cfg keystone_authtoken auth_host "${KEYSTONE_PUBLIC_SERVICE_HOST}"
crudini --set $cfg keystone_authtoken auth_port "${KEYSTONE_PUBLIC_SERVICE_PORT}"
crudini --set $cfg keystone_authtoken auth_uri \
"${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:${KEYSTONE_PUBLIC_SERVICE_PORT}/v2.0"
crudini --set $cfg keystone_authtoken admin_tenant_name "${ADMIN_TENANT_NAME}"
crudini --set $cfg keystone_authtoken admin_user "${MAGNUM_KEYSTONE_USER}"
crudini --set $cfg keystone_authtoken admin_password \
"${MAGNUM_KEYSTONE_PASSWORD}"
crudini --set $cfg api host ${MAGNUM_API_SERVICE_HOST}

View File

@ -0,0 +1,13 @@
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%magnum-base:%%KOLLA_TAG%%
MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum -y install \
openstack-magnum-conductor \
tar \
&& yum clean all
# Install kubectl binary (ugh)
RUN cd /tmp && curl -L https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.15.0/kubernetes.tar.gz -o /tmp/kubernetes.tar.gz && /usr/bin/tar -xzvf /tmp/kubernetes.tar.gz && cp -a /tmp/kubernetes/platforms/linux/amd64/kubectl /usr/bin/kubectl && rm -rf /tmp/kubernetes
ADD ./start.sh /start.sh
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../tools/build-docker-image

View File

@ -0,0 +1,17 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-magnum.sh
check_required_vars MAGNUM_DB_NAME MAGNUM_DB_USER MAGNUM_DB_PASSWORD
fail_unless_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${MAGNUM_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${MAGNUM_DB_NAME}.* TO
'${MAGNUM_DB_USER}'@'%' IDENTIFIED BY '${MAGNUM_DB_PASSWORD}'
EOF
/usr/bin/magnum-db-manage upgrade
exec /usr/bin/magnum-conductor

View File

@ -110,6 +110,12 @@ all containers. This allows a simple method of ensuring every type of node
RABBITMQ_USER=<rabbit> - The RabbitMQ user name
RABBIT_PASSWORD=<password> - The RabbitMQ password
RABBIT_USERID=<rabbit> - The RabbitMQ user id on the host
MAGNUM_DB_NAME=<magnum> - The Magnum database name
MAGNUM_DB_PASSWORD=<kolla> - The Magnum database password
MAGNUM_KEYSTONE_PASSWORD=<magnum> - The Magnum keystone password
MAGNUM_API_SERVICE_HOST=<IP> - The Magnum Host IP address
MAGNUM_API_SERVICE_PORT=<9511> - The Magnum port
[Minimum environment variable setup guide.](https://github.com/stackforge/kolla/blob/master/docs/minimal-environment-vars.md)

View File

@ -117,6 +117,13 @@ HEAT_API_SERVICE_HOST=$HOST_IP
HEAT_API_CFN_SERVICE_HOST=$HOST_IP
HEAT_API_CFN_URL_HOST=$HOST_IP
# Magnum
MAGNUM_DB_NAME=magnum
MAGNUM_DB_PASSWORD=kolla
MAGNUM_KEYSTONE_PASSWORD=magnum
MAGNUM_API_SERVICE_HOST=$HOST_IP
MAGNUM_API_SERVICE_PORT=9511
cat > ./openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME=$ADMIN_TENANT_NAME
@ -147,6 +154,7 @@ ADMIN_TENANT_NAME=$ADMIN_TENANT_NAME
DB_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD
FLAT_INTERFACE=$NOVA_FLAT_INTERFACE
GLANCE_API_SERVICE_HOST=$GLANCE_API_SERVICE_HOST
MAGNUM_API_SERVICE_HOST=$MAGNUM_API_SERVICE_PORT
GLANCE_DB_NAME=$GLANCE_DB_NAME
GLANCE_DB_PASSWORD=$GLANCE_DB_PASSWORD
GLANCE_DB_USER=$GLANCE_DB_USER
@ -192,6 +200,10 @@ HEAT_DB_NAME=$HEAT_DB_NAME
HEAT_DB_PASSWORD=$HEAT_DB_PASSWORD
HEAT_KEYSTONE_PASSWORD=$HEAT_KEYSTONE_PASSWORD
HEAT_API_SERVICE_HOST=$HEAT_API_SERVICE_HOST
MAGNUM_DB_NAME=$MAGNUM_DB_NAME
MAGNUM_DB_PASSWORD=$MAGNUM_DB_PASSWORD
MAGNUM_KEYSTONE_PASSWORD=$MAGNUM_KEYSTONE_PASSWORD
MAGNUM_API_SERVICE_HOST=$MAGNUM_API_SERVICE_HOST
PUBLIC_INTERFACE=$NOVA_PUBLIC_INTERFACE
PUBLIC_IP=$HOST_IP
PUBLIC_IP=$PUBLIC_IP

View File

@ -38,6 +38,7 @@ function process_all {
process neutron-agents
fi
process heat-api-engine
process magnum-api-conductor
process horizon
}