From de313681f94a75b3dbcb078fa023495e2c04617f Mon Sep 17 00:00:00 2001 From: Daneyon Hansen Date: Mon, 13 Oct 2014 16:36:17 +0000 Subject: [PATCH] Adds Neutron Server Support Previously Kolla did not support Neutron. This patch provides initial Neutron support by implementing neutron-server functionality. It also creates a neutron-base image that provides common config and packages for all Neutron-based services. Partially Implements: Blueprint Kubernetes Neutron Container Change-Id: I2399a1331992fae0f387f01e5b5c1c1d34f0637d --- docker/neutron/neutron-base/Dockerfile | 8 ++ docker/neutron/neutron-base/build | 1 + docker/neutron/neutron-base/config-neutron.sh | 87 +++++++++++++++ docker/neutron/neutron-server/Dockerfile | 17 +++ docker/neutron/neutron-server/build | 1 + docker/neutron/neutron-server/check.sh | 17 +++ docker/neutron/neutron-server/start.sh | 104 ++++++++++++++++++ k8s/pod/neutron-controller-pod.yaml | 30 +++++ k8s/service/neutron-server-service.yaml | 7 ++ tools/start-all-pods | 1 + tools/start-all-services | 1 + 11 files changed, 274 insertions(+) create mode 100644 docker/neutron/neutron-base/Dockerfile create mode 120000 docker/neutron/neutron-base/build create mode 100644 docker/neutron/neutron-base/config-neutron.sh create mode 100644 docker/neutron/neutron-server/Dockerfile create mode 120000 docker/neutron/neutron-server/build create mode 100755 docker/neutron/neutron-server/check.sh create mode 100755 docker/neutron/neutron-server/start.sh create mode 100644 k8s/pod/neutron-controller-pod.yaml create mode 100644 k8s/service/neutron-server-service.yaml diff --git a/docker/neutron/neutron-base/Dockerfile b/docker/neutron/neutron-base/Dockerfile new file mode 100644 index 0000000000..ab8890326b --- /dev/null +++ b/docker/neutron/neutron-base/Dockerfile @@ -0,0 +1,8 @@ +FROM kollaglue/fedora-rdo-base +MAINTAINER Daneyon Hansen + +RUN yum -y install openstack-neutron-ml2 ; yum clean all + +RUN mkdir -p /opt/kolla +COPY config-neutron.sh /opt/kolla/config-neutron.sh + diff --git a/docker/neutron/neutron-base/build b/docker/neutron/neutron-base/build new file mode 120000 index 0000000000..43944faa00 --- /dev/null +++ b/docker/neutron/neutron-base/build @@ -0,0 +1 @@ +../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/neutron/neutron-base/config-neutron.sh b/docker/neutron/neutron-base/config-neutron.sh new file mode 100644 index 0000000000..1b60709af5 --- /dev/null +++ b/docker/neutron/neutron-base/config-neutron.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +set -e + +. /opt/kolla/kolla-common.sh + +: ${ADMIN_TENANT_NAME:=admin} +: ${NEUTRON_DB_NAME:=neutron} +: ${NEUTRON_DB_USER:=neutron} +: ${NEUTRON_KEYSTONE_USER:=neutron} +: ${KEYSTONE_AUTH_PROTOCOL:=http} +: ${RABBIT_HOST:=$RABBITMQ_SERVICE_HOST} +: ${RABBIT_USER:=guest} +: ${RABBIT_PASSWORD:=guest} + +check_required_vars NEUTRON_KEYSTONE_PASSWORD +dump_vars + +cat > /openrc < + +#Install required packages +RUN yum install -y openstack-neutron \ + python-neutronclient \ + mariadb \ + ; yum clean all + +VOLUME /var/lib/neutron + +EXPOSE 9696 + +ADD ./start.sh /start.sh +ADD ./check.sh /check.sh + +CMD ["/start.sh"] diff --git a/docker/neutron/neutron-server/build b/docker/neutron/neutron-server/build new file mode 120000 index 0000000000..43944faa00 --- /dev/null +++ b/docker/neutron/neutron-server/build @@ -0,0 +1 @@ +../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/neutron/neutron-server/check.sh b/docker/neutron/neutron-server/check.sh new file mode 100755 index 0000000000..2a44cda912 --- /dev/null +++ b/docker/neutron/neutron-server/check.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! neutron ext-list > /dev/null; then + echo "ERROR: neutron ext-list failed" >&2 + RES=1 + fi +fi + +exit $RES + diff --git a/docker/neutron/neutron-server/start.sh b/docker/neutron/neutron-server/start.sh new file mode 100755 index 0000000000..92ab935c53 --- /dev/null +++ b/docker/neutron/neutron-server/start.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-neutron.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + NEUTRON_KEYSTONE_USER NEUTRON_KEYSTONE_PASSWORD \ + ADMIN_TENANT_NAME NEUTRON_SERVER_SERVICE_HOST \ + PUBLIC_IP +check_for_keystone +check_for_db + +mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <