Dynamically get public and internal IPs for Kingbird endpoints

In order to keep opnfv installation flexible, the endpoints IPs are
now fetched from the endpoint list. Currently I'm using keystone as
a required service to get the IP addresses for public, admin and
internal endpoints.

Change-Id: Ib110ace9ccff95dd03287b9d29dfee89a14dd6ce
This commit is contained in:
Dimitri Mazmanov 2016-07-11 11:34:05 +02:00
parent fc95e87f21
commit c0d6069d6f
2 changed files with 11 additions and 5 deletions

View File

@ -8,20 +8,28 @@ set -o pipefail
# Ensure that openrc containing OpenStack environment variables is present.
source openrc
# Endpoints. Dynamically get IP addresses from another service (keystone)
KINGBIRD_PUBLIC_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 6 | cut -d '/' -f 3 | cut -d ':' -f 1)
KINGBIRD_ADMIN_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 7 | cut -d '/' -f 3 | cut -d ':' -f 1)
KINGBIRD_INTERNAL_URL=$(openstack endpoint list --long | grep keystone | cut -d '|' -f 7 | cut -d '/' -f 3 | cut -d ':' -f 1)
# MySQL
mysql_host=$(mysql -uroot -se "SELECT SUBSTRING_INDEX(USER(), '@', -1);")
mysql_user='kingbird'
mysql_pass='mysql_kb'
mysql_db='kingbird'
# Keystone
admin_password='keystone_kb_pass'
admin_user='kingbird'
admin_tenant_name='services'
auth_uri=$OS_AUTH_URL"v3"
# Rabbit
rabbit_user='nova'
rabbit_password=$(sed -n 's/^rabbit_password *= *\([^ ]*.*\)/\1/p' < /etc/nova/nova.conf)
rabbit_hosts=$(sed -n 's/^rabbit_hosts *= *\([^ ]*.*\)/\1/p' < /etc/nova/nova.conf)
# Config
KINGBIRD_CONF_FILE='/etc/kingbird/kingbird.conf'
bind_host=$(sed -n 's/^admin_bind_host *= *\([^ ]*.*\)/\1/p' < /etc/keystone/keystone.conf)
@ -153,5 +161,5 @@ iniset $KINGBIRD_CONF_FILE database max_pool_size 1000
mkdir -p /var/log/kingbird
kingbird-manage --config-file $KINGBIRD_CONF_FILE db_sync
nohup kingbird-engine --config-file $KINGBIRD_CONF_FILE > /var/log/kingbird/kingbird-engine.log &
nohup kingbird-api --config-file $KINGBIRD_CONF_FILE > /var/log/kingbird/kingbird-api.log &
nohup kingbird-engine --config-file $KINGBIRD_CONF_FILE --log-file /var/log/kingbird/kingbird-engine.log &
nohup kingbird-api --config-file $KINGBIRD_CONF_FILE --log-file /var/log/kingbird/kingbird-api.log &

View File

@ -15,7 +15,5 @@ export KEYSTONE_ENDPOINT_TYPE='internalURL'
export NOVA_ENDPOINT_TYPE='internalURL'
export NEUTRON_ENDPOINT_TYPE='internalURL'
export OS_ENDPOINT_TYPE='internalURL'
export KINGBIRD_PUBLIC_URL='http://172.16.0.3:8118/v1.0'
export KINGBIRD_INTERNAL_URL='http://192.168.0.2:8118/v1.0'
export KINGBIRD_ADMIN_URL='http://192.168.0.2:8118/v1.0'