Merge "Add config-internal/config-external to Magnum containers"

This commit is contained in:
Jenkins 2015-07-09 22:45:12 +00:00 committed by Gerrit Code Review
commit 667aed114f
13 changed files with 97 additions and 44 deletions

View File

@ -8,4 +8,6 @@ RUN yum -y install \
ADD ./start.sh /start.sh
ADD ./check.sh /check.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/magnum/magnum-api/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/magnum/magnum-api/config-internal.sh

View File

@ -10,4 +10,7 @@ RUN yum -y install \
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
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/magnum/magnum-conductor/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/magnum/magnum-conductor/config-internal.sh

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/magnum/magnum-api/magnum.conf"
TARGET="/etc/magnum/magnum.conf"
OWNER="magnum"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

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

@ -1,27 +1,20 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-magnum.sh
set -o errexit
CMD="/usr/bin/magnum-api"
ARGS=""
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
# Loading common functions.
source /opt/kolla/kolla-common.sh
fail_unless_os_service_running keystone
# Config-internal script exec out of this function, it does not return here.
set_configs
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
# 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
su -s /bin/sh -c "magnum-manage db_sync" magnum
exit 0
fi
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
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/magnum/magnum-conductor/magnum.conf"
TARGET="/etc/magnum/magnum.conf"
OWNER="magnum"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

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

@ -1,17 +1,14 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-magnum.sh
set -o errexit
check_required_vars MAGNUM_DB_NAME MAGNUM_DB_USER MAGNUM_DB_PASSWORD
fail_unless_db
CMD="/usr/bin/magnum-conductor"
ARGS=""
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
# Loading common functions.
source /opt/kolla/kolla-common.sh
/usr/bin/magnum-db-manage upgrade
# Config-internal script exec out of this function, it does not return here.
set_configs
exec /usr/bin/magnum-conductor
exec $CMD $ARGS

View File

@ -300,15 +300,7 @@ In order for each service to function, there is a minimum set of required variab
# Magnum-api
ADMIN_TENANT_NAME
KEYSTONE_ADMIN_SERVICE_HOST
KEYSTONE_ADMIN_SERVICE_PORT
KEYSTONE_ADMIN_TOKEN
KEYSTONE_AUTH_PROTOCOL
MAGNUM_API_SERVICE_HOST
MAGNUM_API_SERVICE_PORT
MAGNUM_KEYSTONE_PASSWORD
MAGNUM_KEYSTONE_USER
None
# Magnum-base
@ -327,9 +319,7 @@ In order for each service to function, there is a minimum set of required variab
# Magnum-conductor
MAGNUM_DB_NAME
MAGNUM_DB_PASSWORD
MAGNUM_DB_USER
None
# Mariadb