Merge "Add designate-sink service"
This commit is contained in:
commit
037b8c4d46
@ -52,3 +52,14 @@ designatemdns:
|
||||
restart: always
|
||||
env_file:
|
||||
- openstack.env
|
||||
|
||||
# The Sink service gets notifications from the message queue about events like
|
||||
# instance creation/deletion or floating IP association/disassociation.
|
||||
# It then creates records for instances included in events.
|
||||
designatesink:
|
||||
image: kollaglue/centos-rdo-designate-sink:latest
|
||||
name: designate-sink
|
||||
net: "host"
|
||||
restart: always
|
||||
env_file:
|
||||
- openstack.env
|
||||
|
@ -4,6 +4,23 @@ set -e
|
||||
|
||||
. /opt/kolla/kolla-common.sh
|
||||
|
||||
get_or_create_domain() {
|
||||
local DOMAIN_NAME=$1
|
||||
|
||||
DOMAIN_ID=$(designate domain-create --name $DOMAIN_NAME | awk '/id/ { print $4; }')
|
||||
# Searching domain if not created
|
||||
if [ -z $DOMAIN_ID ]; then
|
||||
DOMAIN_ID=$(designate domain-list | awk "/$DOMAIN_NAME/ { print \$2; }")
|
||||
fi
|
||||
# Fail if domain still don't exist
|
||||
if [ -z $DOMAIN_ID ]; then
|
||||
echo "Creating domain failed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $DOMAIN_ID
|
||||
}
|
||||
|
||||
check_required_vars DESIGNATE_DB_PASSWORD DESIGNATE_KEYSTONE_PASSWORD \
|
||||
KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST \
|
||||
DESIGNATE_BIND9_RNDC_KEY DESIGNATE_BACKEND \
|
||||
|
11
docker/centos/binary/designate/designate-sink/Dockerfile
Normal file
11
docker/centos/binary/designate/designate-sink/Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%designate-base:%%KOLLA_TAG%%
|
||||
MAINTAINER Kolla Project (https://launchpad.net/kolla)
|
||||
|
||||
RUN yum install -y \
|
||||
openstack-designate-sink \
|
||||
python-designateclient \
|
||||
&& yum clean all
|
||||
|
||||
COPY start.sh /start.sh
|
||||
|
||||
CMD ["/start.sh"]
|
1
docker/centos/binary/designate/designate-sink/build
Symbolic link
1
docker/centos/binary/designate/designate-sink/build
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../../tools/build-docker-image
|
64
docker/centos/binary/designate/designate-sink/start.sh
Executable file
64
docker/centos/binary/designate/designate-sink/start.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. /opt/kolla/kolla-common.sh
|
||||
. /opt/kolla/config-designate.sh
|
||||
|
||||
CONF=/etc/designate/designate.conf
|
||||
|
||||
configure_nova_handler() {
|
||||
local DOMAIN_ID=$1
|
||||
|
||||
crudini --set $CONF handler:nova_fixed domain_id "$DOMAIN_ID"
|
||||
crudini --set $CONF handler:nova_fixed notification_topics "notifications"
|
||||
crudini --set $CONF handler:nova_fixed control_exchange "nova"
|
||||
# Configuring multiple record formats
|
||||
for FORMAT in $DESIGNATE_SINK_NOVA_FORMATS; do
|
||||
crudini --set $CONF handler:nova_fixed format "$FORMAT"
|
||||
done
|
||||
}
|
||||
|
||||
configure_neutron_handler() {
|
||||
local DOMAIN_ID=$1
|
||||
|
||||
crudini --set $CONF handler:neutron_floatingip domain_id "$DOMAIN_ID"
|
||||
crudini --set $CONF handler:neutron_floatingip notification_topics "notifications"
|
||||
crudini --set $CONF handler:neutron_floatingip control_exchange "neutron"
|
||||
# Configuring multiple record formats
|
||||
for FORMAT in $DESIGNATE_SINK_NEUTRON_FORMATS; do
|
||||
crudini --set $CONF handler:neutron_floatingip format "$FORMAT"
|
||||
done
|
||||
}
|
||||
|
||||
check_required_vars DESIGNATE_API_SERVICE_HOST DESIGNATE_API_SERVICE_PORT \
|
||||
DESIGNATE_DEFAULT_POOL_NS_RECORD
|
||||
|
||||
check_for_os_service_endpoint designate DESIGNATE_API_SERVICE_HOST DESIGNATE_API_SERVICE_PORT || exit $?
|
||||
|
||||
if [ -z "$DESIGNATE_SINK_NOVA_DOMAIN_NAME" && -z "$DESIGNATE_SINK_NEUTRON_DOMAIN_NAME" ]; then
|
||||
echo "Please specify either Nova or Neutron domain name for Designate Sink"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
designate server-create --name ${DESIGNATE_DEFAULT_POOL_NS_RECORD}
|
||||
if [ $? != 0 ]; then
|
||||
echo "Creating server failed" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$DESIGNATE_SINK_NOVA_DOMAIN_NAME" ]; then
|
||||
NOVA_DOMAIN_ID=$(get_or_create_domain $DESIGNATE_SINK_NOVA_DOMAIN_NAME)
|
||||
configure_nova_handler $NOVA_DOMAIN_ID
|
||||
HANDLERS="nova_fixed"
|
||||
fi
|
||||
|
||||
if [ -n "$DESIGNATE_SINK_NEUTRON_DOMAIN_NAME" ]; then
|
||||
NEUTRON_DOMAIN_ID=$(get_or_create_domain $DESIGNATE_SINK_NEUTRON_DOMAIN_NAME)
|
||||
configure_neutron_handler $NEUTRON_DOMAIN_ID
|
||||
[ -n "$HANDLERS" ] && HANDLERS+=","
|
||||
HANDLERS+="neutron_floatingip"
|
||||
fi
|
||||
|
||||
crudini --set $CONF service:sink enabled_notification_handlers "$HANDLERS"
|
||||
|
||||
exec /usr/bin/designate-sink
|
@ -137,6 +137,11 @@ all containers. This allows a simple method of ensuring every type of node
|
||||
DESIGNATE_DNS_PORT=<53> - The port of the Designate-backed DNS slaves that are used by the world
|
||||
DESIGNATE_INITDB=<true|false> - Configures if the database should be created and initialised
|
||||
DESIGNATE_ALLOW_RECURSION=<true|false> - Configure a recursive nameserver
|
||||
DESIGNATE_DEFAULT_POOL_NS_RECORD=<ns1.example.org.> - Name of server used to generate NS records
|
||||
DESIGNATE_SINK_NOVA_DOMAIN_NAME=<nova.example.org.> - Name of domain used to create records from Nova notifications
|
||||
DESIGNATE_SINK_NEUTRON_DOMAIN_NAME=<neutron.example.org.> - Name of domain used to create records from Neutron notifications
|
||||
DESIGNATE_SINK_NOVA_FORMATS=<("%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s" "%(hostname)s.%(domain)s")> - List of formats for records that will be created by Nova handler
|
||||
DESIGNATE_SINK_NEUTRON_FORMATS=<("%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s" "%(hostname)s.%(domain)s")> - List of formats for records that will be created by Neutron handler
|
||||
|
||||
|
||||
[Minimum environment variable setup guide.](https://github.com/stackforge/kolla/blob/master/docs/minimal-environment-vars.md)
|
||||
|
@ -151,6 +151,11 @@ DESIGNATE_POOLMAN_TARGETS=$(uuidgen)
|
||||
DESIGNATE_POOLMAN_NSS=$(uuidgen)
|
||||
DESIGNATE_INITDB=true
|
||||
DESIGNATE_ALLOW_RECURSION=true
|
||||
DESIGNATE_DEFAULT_POOL_NS_RECORD=ns1.example.org.
|
||||
DESIGNATE_SINK_NOVA_DOMAIN_NAME=nova.example.org.
|
||||
DESIGNATE_SINK_NEUTRON_DOMAIN_NAME=neutron.example.org.
|
||||
DESIGNATE_SINK_NOVA_FORMATS=("%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s" "%(hostname)s.%(domain)s")
|
||||
DESIGNATE_SINK_NEUTRON_FORMATS=("%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(domain)s" "%(hostname)s.%(domain)s")
|
||||
|
||||
cat > ./openrc <<EOF
|
||||
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
|
||||
@ -260,6 +265,9 @@ DESIGNATE_POOLMAN_TARGETS=$DESIGNATE_POOLMAN_TARGETS
|
||||
DESIGNATE_POOLMAN_NSS=$DESIGNATE_POOLMAN_NSS
|
||||
DESIGNATE_INITDB=$DESIGNATE_INITDB
|
||||
DESIGNATE_ALLOW_RECURSION=$DESIGNATE_ALLOW_RECURSION
|
||||
DESIGNATE_DEFAULT_POOL_NS_RECORD=$DESIGNATE_DEFAULT_POOL_NS_RECORD
|
||||
DESIGNATE_SINK_NOVA_DOMAIN_NAME=$DESIGNATE_SINK_NOVA_DOMAIN_NAME
|
||||
DESIGNATE_SINK_NEUTRON_DOMAIN_NAME=$DESIGNATE_SINK_NEUTRON_DOMAIN_NAME
|
||||
DB_CLUSTER_BIND_ADDRESS=$DB_CLUSTER_BIND_ADDRESS
|
||||
DB_CLUSTER_INIT_DB=$DB_CLUSTER_INIT_DB
|
||||
DB_CLUSTER_NAME=$DB_CLUSTER_NAME
|
||||
|
Loading…
Reference in New Issue
Block a user