Add config-internal/config-external to Heat containers

Partially Implements: Blueprint standard-start

Change-Id: Ia353ea4292e1f183949e8fc1c68ed345d1edc884
This commit is contained in:
Harm Weites 2015-07-02 21:15:14 +02:00
parent 3a4500c122
commit b07bb59c2d
18 changed files with 157 additions and 68 deletions

View File

@ -9,4 +9,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/heat/heat-api-cfn/config-external.sh

View File

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

View File

@ -11,4 +11,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/heat/heat-api/config-external.sh

View File

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

View File

@ -10,4 +10,7 @@ RUN yum -y install \
&& yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/heat/heat-engine/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/heat/heat-engine/config-internal.sh

View File

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

View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
HEAT_CFN_KEYSTONE_USER HEAT_CFN_KEYSTONE_PASSWORD \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \
ADMIN_TENANT_NAME HEAT_API_CFN_SERVICE_HOST \
HEAT_API_CFN_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 ${HEAT_CFN_KEYSTONE_USER} \
-p ${HEAT_CFN_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${HEAT_CFN_KEYSTONE_USER} -t cloudformation \
-I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1"
exec /usr/bin/heat-api-cfn

View File

@ -1,28 +1,13 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
CMD="/usr/bin/heat-api-cfn"
ARGS=""
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
HEAT_CFN_KEYSTONE_USER HEAT_CFN_KEYSTONE_PASSWORD \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \
ADMIN_TENANT_NAME HEAT_API_CFN_SERVICE_HOST \
HEAT_API_CFN_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 ${HEAT_CFN_KEYSTONE_USER} \
-p ${HEAT_CFN_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${HEAT_CFN_KEYSTONE_USER} -t cloudformation \
-I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_CFN_SERVICE_HOST}:${HEAT_API_CFN_SERVICE_PORT}/v1"
exec /usr/bin/heat-api-cfn
exec $CMD $ARGS

View File

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

View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
HEAT_KEYSTONE_USER HEAT_KEYSTONE_PASSWORD \
KEYSTONE_AUTH_PROTOCOL ADMIN_TENANT_NAME \
HEAT_API_SERVICE_HOST PUBLIC_IP
fail_unless_os_service_running keystone
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:35357/v2.0"
crux user-create -n ${HEAT_KEYSTONE_USER} \
-p ${HEAT_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${HEAT_KEYSTONE_USER} -t orchestration \
-I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8004/v1/%(tenant_id)s" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s"
# will use crux after https://github.com/larsks/crux/issues/1 is implemented
openstack role list --os-token="${KEYSTONE_ADMIN_TOKEN}" --os-url $SERVICE_ENDPOINT -f csv | tail -n +2 | awk -F, '{print $2}' | grep heat_stack_user || keystone role-create --name heat_stack_user
exec /usr/bin/heat-api

View File

@ -1,29 +1,13 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
CMD="/usr/bin/heat-api"
ARGS=""
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \
HEAT_KEYSTONE_USER HEAT_KEYSTONE_PASSWORD \
KEYSTONE_AUTH_PROTOCOL ADMIN_TENANT_NAME \
HEAT_API_SERVICE_HOST PUBLIC_IP
# 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}:35357/v2.0"
crux user-create -n ${HEAT_KEYSTONE_USER} \
-p ${HEAT_KEYSTONE_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux endpoint-create --remove-all -n ${HEAT_KEYSTONE_USER} -t orchestration \
-I "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8004/v1/%(tenant_id)s" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${HEAT_API_SERVICE_HOST}:8004/v1/%(tenant_id)s"
# will use crux after https://github.com/larsks/crux/issues/1 is implemented
openstack role list --os-token="${KEYSTONE_ADMIN_TOKEN}" --os-url $SERVICE_ENDPOINT -f csv | tail -n +2 | awk -F, '{print $2}' | grep heat_stack_user || keystone role-create --name heat_stack_user
exec /usr/bin/heat-api
exec $CMD $ARGS

View File

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

View File

@ -0,0 +1,28 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
. /openrc
check_required_vars HEAT_DB_NAME HEAT_DB_USER HEAT_DB_PASSWORD \
INIT_HEAT_DB HEAT_DOMAIN_PASS
fail_unless_db
if [ "${INIT_HEAT_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${HEAT_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${HEAT_DB_NAME}.* TO
'${HEAT_DB_USER}'@'%' IDENTIFIED BY '${HEAT_DB_PASSWORD}'
EOF
/usr/bin/heat-manage db_sync
# If the database needs to be created, assume keystone-setup is allowed to
# run as well.
heat-keystone-setup-domain \
--stack-user-domain-name heat_user_domain \
--stack-domain-admin heat_domain_admin \
--stack-domain-admin-password ${HEAT_DOMAIN_PASS}
fi
exec /usr/bin/heat-engine

View File

@ -1,28 +1,20 @@
#!/bin/bash
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
. /openrc
CMD="/usr/bin/heat-engine"
ARGS=""
check_required_vars HEAT_DB_NAME HEAT_DB_USER HEAT_DB_PASSWORD \
INIT_HEAT_DB HEAT_DOMAIN_PASS
fail_unless_db
# Loading common functions.
source /opt/kolla/kolla-common.sh
if [ "${INIT_HEAT_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${HEAT_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${HEAT_DB_NAME}.* TO
'${HEAT_DB_USER}'@'%' IDENTIFIED BY '${HEAT_DB_PASSWORD}'
EOF
# Config-internal script exec out of this function, it does not return here.
set_configs
/usr/bin/heat-manage db_sync
# If the database needs to be created, assume keystone-setup is allowed to
# run as well.
heat-keystone-setup-domain \
--stack-user-domain-name heat_user_domain \
--stack-domain-admin heat_domain_admin \
--stack-domain-admin-password ${HEAT_DOMAIN_PASS}
# 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/bash -c "/usr/bin/heat-manage db_sync" heat
exit 0
fi
exec /usr/bin/heat-engine
exec $CMD $ARGS