aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Dake <stdake@cisco.com>2015-02-18 11:04:08 -0700
committerSteven Dake <stdake@cisco.com>2015-02-18 15:53:18 -0700
commit82f950f5a5906f785e1bd23ad9c225d9af301ce3 (patch)
tree505bd5a388cbfcf73a1ab8ae5ead743070fc933f
parentde13d7eb50757a2f8a600bd2de0d12d1bb76a4e2 (diff)
downloadkolla-82f950f5a5906f785e1bd23ad9c225d9af301ce3.tar.gz
kolla-82f950f5a5906f785e1bd23ad9c225d9af301ce3.zip
Support multiple different types of base OSes
Ideally we want to support Fedora and CentOS as a base operating system type. The build scripts will rewrite the Dockerfile build scripts to pull in the correct base OS. Change-Id: Ia41e21811caa3a1989c79cc42ce6615eec0c977b Partially-implements: blueprint multi-baseos
-rw-r--r--docker/base/kolla-common.sh79
-rwxr-xr-xdocker/base/service_hosts.sh45
l---------[-rw-r--r--]docker/fedora-rdo-base/kolla-common.sh80
l---------[-rwxr-xr-x]docker/fedora-rdo-base/service_hosts.sh46
4 files changed, 126 insertions, 124 deletions
diff --git a/docker/base/kolla-common.sh b/docker/base/kolla-common.sh
new file mode 100644
index 000000000..56c658c43
--- /dev/null
+++ b/docker/base/kolla-common.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+. /opt/kolla/service_hosts.sh
+
+# Set some generally useful defaults.
+MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') |
+ awk '$4 == "src" {print $5}')
+
+: ${PUBLIC_IP:=${MY_IP}}
+
+# Iterate over a list of variable names and exit if one is
+# undefined.
+check_required_vars() {
+ for var in $*; do
+ if [ -z "${!var}" ]; then
+ echo "ERROR: missing $var" >&2
+ exit 1
+ fi
+ done
+}
+
+# Exit unless we receive a successful response from corresponding OpenStack
+# service.
+check_for_os_service() {
+ local name=$1
+ local host_var=$2
+ local port=$3
+ local api_version=$4
+
+ check_required_vars $host_var
+
+ local endpoint="http://${!host_var}:$port/$api_version"
+
+ curl -sf -o /dev/null "$endpoint" || {
+ echo "ERROR: $name is not available @ $endpoint" >&2
+ exit 1
+ }
+
+ echo "$name is active @ $endpoint"
+}
+
+check_for_glance() {
+ check_for_os_service glance GLANCE_API_SERVICE_HOST 9292
+}
+
+check_for_keystone() {
+ check_for_os_service keystone KEYSTONE_PUBLIC_SERVICE_HOST 5000 v2.0
+}
+
+check_for_nova() {
+ check_for_os_service nova NOVA_API_SERVICE_HOST 8774
+}
+
+check_for_neutron() {
+ check_for_os_service neutron NEUTRON_SERVER_SERVICE_HOST 9696
+}
+
+# Exit unless we receive a successful response from the database server.
+# Optionally takes a database name to check for. Defaults to 'mysql'.
+check_for_db() {
+ local database=${1:-mysql}
+ check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD
+
+ mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" \
+ -e "select 1" $database > /dev/null 2>&1 || {
+ echo "ERROR: database $database is not available @ $MARIADB_SERVICE_HOST" >&2
+ exit 1
+ }
+
+ echo "database is active @ ${MARIADB_SERVICE_HOST}"
+}
+
+# Dump shell environment to a file
+dump_vars() {
+ set -o posix
+ set > /pid_$$_vars.sh
+ set +o posix
+}
+
diff --git a/docker/base/service_hosts.sh b/docker/base/service_hosts.sh
new file mode 100755
index 000000000..af8c643cf
--- /dev/null
+++ b/docker/base/service_hosts.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Kubernetes currently creates FOO_SERVICE_HOST and FOO_SERVICE_PORT env vars
+# as part of starting the containers. However this is not done when starting
+# them with plain docker. Defaulting variables to their common version if
+# they're not already set allows the usage of --link in plain 'docker run' to
+# wire together containers.
+
+: ${BARBICAN_ADMIN_SERVICE_HOST:=$BARBICAN_ADMIN_PORT_9312_TCP_ADDR}
+: ${BARBICAN_ADMIN_SERVICE_PORT:=9312}
+: ${BARBICAN_PUBLIC_SERVICE_HOST:=$BARBICAN_PUBLIC_PORT_9311_TCP_ADDR}
+: ${BARBICAN_PUBLIC_SERVICE_PORT:=9311}
+: ${CEILOMETER_API_SERVICE_HOST:=$CEILOMETER_API_PORT_8777_TCP_ADDR}
+: ${CEILOMETER_API_SERVICE_PORT:=8777}
+: ${GLANCE_API_SERVICE_HOST:=$GLANCE_API_PORT_9292_TCP_ADDR}
+: ${GLANCE_API_SERVICE_PORT:=9292}
+: ${GLANCE_REGISTRY_SERVICE_HOST:=$GLANCE_REGISTRY_PORT_9191_TCP_ADDR}
+: ${GLANCE_REGISTRY_SERVICE_PORT:=9191}
+: ${HEAT_API_SERVICE_HOST:=$HEAT_API_PORT_8004_TCP_ADDR}
+: ${HEAT_API_SERVICE_PORT:=8004}
+: ${HORIZON_SERVICE_HOST:=$HORIZON_PORT_80_TCP_ADDR}
+: ${HORIZON_SERVICE_PORT:=80}
+: ${KEYSTONE_ADMIN_SERVICE_HOST:=$KEYSTONE_ADMIN_PORT_35357_TCP_ADDR}
+: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357}
+: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$KEYSTONE_PUBLIC_PORT_5000_TCP_ADDR}
+: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000}
+: ${MARIADB_SERVICE_HOST:=$MARIADB_PORT_3306_TCP_ADDR}
+: ${MARIADB_SERVICE_PORT:=3306}
+: ${MONGODB_SERVICE_HOST:=$MONGODB_PORT_27017_TCP_ADDR}
+: ${MONGODB_SERVICE_PORT:=27017}
+: ${NEUTRON_SERVER_SERVICE_HOST:=$NEUTRON_SERVER_PORT_9696_TCP_ADDR}
+: ${NEUTRON_SERVER_SERVICE_PORT:=9696}
+: ${NOVA_API_SERVICE_HOST:=$NOVA_API_PORT_8774_TCP_ADDR}
+: ${NOVA_API_SERVICE_PORT:=8774}
+: ${NOVA_EC2_API_SERVICE_HOST:=$NOVA_EC2_API_PORT_8773_TCP_ADDR}
+: ${NOVA_EC2_API_SERVICE_PORT:=8773}
+: ${NOVA_LIBVIRT_SERVICE_HOST:=$NOVA_LIBVIRT_PORT_16509_TCP_ADDR}
+: ${NOVA_LIBVIRT_SERVICE_PORT:=16509}
+: ${NOVA_METADATA_API_SERVICE_HOST:=$NOVA_METADATA_API_PORT_8775_TCP_ADDR}
+: ${NOVA_METADATA_API_SERVICE_PORT:=8775}
+: ${RABBITMQ_SERVICE_HOST:=$RABBITMQ_PORT_5672_TCP_ADDR}
+: ${RABBITMQ_SERVICE_PORT:=5672}
+: ${ZAQAR_SERVER_SERVICE_HOST:=$ZAQAR_SERVER_PORT_8888_TCP_ADDR}
+: ${ZAQAR_SERVER_SERVICE_PORT:=8888}
+
diff --git a/docker/fedora-rdo-base/kolla-common.sh b/docker/fedora-rdo-base/kolla-common.sh
index 56c658c43..fcd13a80e 100644..120000
--- a/docker/fedora-rdo-base/kolla-common.sh
+++ b/docker/fedora-rdo-base/kolla-common.sh
@@ -1,79 +1 @@
-#!/bin/bash
-
-. /opt/kolla/service_hosts.sh
-
-# Set some generally useful defaults.
-MY_IP=$(ip route get $(ip route | awk '$1 == "default" {print $3}') |
- awk '$4 == "src" {print $5}')
-
-: ${PUBLIC_IP:=${MY_IP}}
-
-# Iterate over a list of variable names and exit if one is
-# undefined.
-check_required_vars() {
- for var in $*; do
- if [ -z "${!var}" ]; then
- echo "ERROR: missing $var" >&2
- exit 1
- fi
- done
-}
-
-# Exit unless we receive a successful response from corresponding OpenStack
-# service.
-check_for_os_service() {
- local name=$1
- local host_var=$2
- local port=$3
- local api_version=$4
-
- check_required_vars $host_var
-
- local endpoint="http://${!host_var}:$port/$api_version"
-
- curl -sf -o /dev/null "$endpoint" || {
- echo "ERROR: $name is not available @ $endpoint" >&2
- exit 1
- }
-
- echo "$name is active @ $endpoint"
-}
-
-check_for_glance() {
- check_for_os_service glance GLANCE_API_SERVICE_HOST 9292
-}
-
-check_for_keystone() {
- check_for_os_service keystone KEYSTONE_PUBLIC_SERVICE_HOST 5000 v2.0
-}
-
-check_for_nova() {
- check_for_os_service nova NOVA_API_SERVICE_HOST 8774
-}
-
-check_for_neutron() {
- check_for_os_service neutron NEUTRON_SERVER_SERVICE_HOST 9696
-}
-
-# Exit unless we receive a successful response from the database server.
-# Optionally takes a database name to check for. Defaults to 'mysql'.
-check_for_db() {
- local database=${1:-mysql}
- check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD
-
- mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" \
- -e "select 1" $database > /dev/null 2>&1 || {
- echo "ERROR: database $database is not available @ $MARIADB_SERVICE_HOST" >&2
- exit 1
- }
-
- echo "database is active @ ${MARIADB_SERVICE_HOST}"
-}
-
-# Dump shell environment to a file
-dump_vars() {
- set -o posix
- set > /pid_$$_vars.sh
- set +o posix
-}
-
+../base/kolla-common.sh \ No newline at end of file
diff --git a/docker/fedora-rdo-base/service_hosts.sh b/docker/fedora-rdo-base/service_hosts.sh
index af8c643cf..c36eb4203 100755..120000
--- a/docker/fedora-rdo-base/service_hosts.sh
+++ b/docker/fedora-rdo-base/service_hosts.sh
@@ -1,45 +1 @@
-#!/bin/bash
-
-# Kubernetes currently creates FOO_SERVICE_HOST and FOO_SERVICE_PORT env vars
-# as part of starting the containers. However this is not done when starting
-# them with plain docker. Defaulting variables to their common version if
-# they're not already set allows the usage of --link in plain 'docker run' to
-# wire together containers.
-
-: ${BARBICAN_ADMIN_SERVICE_HOST:=$BARBICAN_ADMIN_PORT_9312_TCP_ADDR}
-: ${BARBICAN_ADMIN_SERVICE_PORT:=9312}
-: ${BARBICAN_PUBLIC_SERVICE_HOST:=$BARBICAN_PUBLIC_PORT_9311_TCP_ADDR}
-: ${BARBICAN_PUBLIC_SERVICE_PORT:=9311}
-: ${CEILOMETER_API_SERVICE_HOST:=$CEILOMETER_API_PORT_8777_TCP_ADDR}
-: ${CEILOMETER_API_SERVICE_PORT:=8777}
-: ${GLANCE_API_SERVICE_HOST:=$GLANCE_API_PORT_9292_TCP_ADDR}
-: ${GLANCE_API_SERVICE_PORT:=9292}
-: ${GLANCE_REGISTRY_SERVICE_HOST:=$GLANCE_REGISTRY_PORT_9191_TCP_ADDR}
-: ${GLANCE_REGISTRY_SERVICE_PORT:=9191}
-: ${HEAT_API_SERVICE_HOST:=$HEAT_API_PORT_8004_TCP_ADDR}
-: ${HEAT_API_SERVICE_PORT:=8004}
-: ${HORIZON_SERVICE_HOST:=$HORIZON_PORT_80_TCP_ADDR}
-: ${HORIZON_SERVICE_PORT:=80}
-: ${KEYSTONE_ADMIN_SERVICE_HOST:=$KEYSTONE_ADMIN_PORT_35357_TCP_ADDR}
-: ${KEYSTONE_ADMIN_SERVICE_PORT:=35357}
-: ${KEYSTONE_PUBLIC_SERVICE_HOST:=$KEYSTONE_PUBLIC_PORT_5000_TCP_ADDR}
-: ${KEYSTONE_PUBLIC_SERVICE_PORT:=5000}
-: ${MARIADB_SERVICE_HOST:=$MARIADB_PORT_3306_TCP_ADDR}
-: ${MARIADB_SERVICE_PORT:=3306}
-: ${MONGODB_SERVICE_HOST:=$MONGODB_PORT_27017_TCP_ADDR}
-: ${MONGODB_SERVICE_PORT:=27017}
-: ${NEUTRON_SERVER_SERVICE_HOST:=$NEUTRON_SERVER_PORT_9696_TCP_ADDR}
-: ${NEUTRON_SERVER_SERVICE_PORT:=9696}
-: ${NOVA_API_SERVICE_HOST:=$NOVA_API_PORT_8774_TCP_ADDR}
-: ${NOVA_API_SERVICE_PORT:=8774}
-: ${NOVA_EC2_API_SERVICE_HOST:=$NOVA_EC2_API_PORT_8773_TCP_ADDR}
-: ${NOVA_EC2_API_SERVICE_PORT:=8773}
-: ${NOVA_LIBVIRT_SERVICE_HOST:=$NOVA_LIBVIRT_PORT_16509_TCP_ADDR}
-: ${NOVA_LIBVIRT_SERVICE_PORT:=16509}
-: ${NOVA_METADATA_API_SERVICE_HOST:=$NOVA_METADATA_API_PORT_8775_TCP_ADDR}
-: ${NOVA_METADATA_API_SERVICE_PORT:=8775}
-: ${RABBITMQ_SERVICE_HOST:=$RABBITMQ_PORT_5672_TCP_ADDR}
-: ${RABBITMQ_SERVICE_PORT:=5672}
-: ${ZAQAR_SERVER_SERVICE_HOST:=$ZAQAR_SERVER_PORT_8888_TCP_ADDR}
-: ${ZAQAR_SERVER_SERVICE_PORT:=8888}
-
+../base/service_hosts.sh \ No newline at end of file