designate/devstack/designate_plugins/backend-agent
Kiall Mac Innes 620fc6ec97 Add Agent DevStack Backend
* Add a new backend for DevStack allowing the Agent
  backend to be configured.
* Change the agent to choose a sane port by default, it's extremely
  unlikely anyone is exposing the agent on port 53 intentionally.
* The agent itself is not yet configured, this will come later as it
  involves refactoring most of the BIND non-agent backend into a lib.
* Fail when the user asks for the agent backend, without also enabling
  the agent service.

Change-Id: Iedde58f4f5a2ea89cb9da78aaec1853208af8fc9
2016-04-14 20:58:06 +01:00

104 lines
2.9 KiB
Plaintext

# Configure the agent backend
# Enable with:
# DESIGNATE_BACKEND_DRIVER=agent
# DESIGNATE_AGENT_BACKEND_DRIVER=<an agent backend>
# Dependencies:
# ``functions`` file
# ``designate`` configuration
# install_designate_backend - install any external requirements
# configure_designate_backend - make configuration changes, including those to other services
# init_designate_backend - initialize databases, etc.
# start_designate_backend - start any external services
# stop_designate_backend - stop any external services
# cleanup_designate_backend - remove transient data and cache
# Save trace setting
DP_AGENT_XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Get agent backend configuration
# -------------------------------
if [[ -r $DESIGNATE_PLUGINS/backend-agent-$DESIGNATE_AGENT_BACKEND_DRIVER ]]; then
# Load plugin
source $DESIGNATE_PLUGINS/backend-agent-$DESIGNATE_AGENT_BACKEND_DRIVER
fi
# Entry Points
# ------------
# install_designate_backend - install any external requirements
function install_designate_backend {
# Install the Agent Backend
install_designate_agent_backend
}
# configure_designate_backend - make configuration changes, including those to other services
function configure_designate_backend {
# Generate Designate pool.yaml file
sudo tee $DESIGNATE_CONF_DIR/pools.yaml > /dev/null <<EOF
---
- name: default
description: DevStack Agent Pool
attributes: {}
ns_records:
- hostname: $DESIGNATE_DEFAULT_NS_RECORD
priority: 1
nameservers:
- host: $DESIGNATE_SERVICE_HOST
port: $DESIGNATE_SERVICE_PORT_DNS
targets:
- type: agent
description: Agent Instance
masters:
- host: $DESIGNATE_SERVICE_HOST
port: $DESIGNATE_SERVICE_PORT_MDNS
options:
host: $DESIGNATE_SERVICE_HOST
port: $DESIGNATE_SERVICE_PORT_AGENT
EOF
# Configure Agent Settings
iniset $DESIGNATE_CONF service:agent backend_driver $DESIGNATE_AGENT_BACKEND_DRIVER
iniset $DESIGNATE_CONF service:agent host $DESIGNATE_SERVICE_HOST
iniset $DESIGNATE_CONF service:agent port $DESIGNATE_SERVICE_PORT_AGENT
iniset $DESIGNATE_CONF service:agent masters "$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS"
# Configure the Agent Backend
configure_designate_agent_backend
}
# init_designate_backend - initialize databases, etc.
function init_designate_backend {
# Init the Agent Backend
init_designate_agent_backend
}
# start_designate_backend - start any external services
function start_designate_backend {
# Start the Agent Backend
start_designate_agent_backend
}
# stop_designate_backend - stop any external services
function stop_designate_backend {
# Stop the Agent Backend
stop_designate_agent_backend
}
# cleanup_designate_backend - remove transient data and cache
function cleanup_designate_backend {
# Cleanup the Agent Backend
cleanup_designate_agent_backend
}
# Restore xtrace
$DP_AGENT_XTRACE