Designate - Neutron integration

This patchset implements Designate - Neutron integration feature
based on Neutron extension drivers. As a result DNS records can be
automatically created in Designate when Neutron ports or floating
IPs are created.

Closes-Bug: #1704769
Depends-On: I13b2ab39bd1daac13112398762f2be06022594b0
Change-Id: I001507eff6a3342cc77188e0f4087fa4fcc67b95
This commit is contained in:
Tytus Kurek 2017-11-20 10:53:10 +01:00 committed by David Ames
parent edab27eaf2
commit 61ae382152
6 changed files with 71 additions and 15 deletions

View File

@ -18,13 +18,13 @@ charms:
juju add-relation designate rabbitmq-server
juju add-relation designate keystone
To add support for auto-generated records when guests are booted the charm
needs a relation with nova-compute:
To add support for DNS record auto-generation when Neutron ports and
floating IPs are created the charm needs a relation with neutron-api charm:
juju deploy nova-compute
juju add-relation designate nova-compute
juju deploy neutron-api
juju add-relation designate neutron-api
The charm needs to store DNS records. This can be achieved by setting the
The charm needs to store DNS records. This can be achieved by setting the
dns-slave config option or by relating to the designate-bind charm:
juju deploy designate-bind

View File

@ -10,11 +10,15 @@ options:
nova-domain:
type: string
default:
description: Domain to add records for new instances to
description: |
Domain to add records for new instances to
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
nova-domain-email:
type: string
default:
description: Email address of the person responsible for the domain.
description: |
Email address of the person responsible for the domain.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
nameservers:
type: string
default:
@ -25,27 +29,39 @@ options:
neutron-domain:
type: string
default:
description: Domain to add floating IP records to.
description: |
Domain to add floating IP records to.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
neutron-domain-email:
type: string
default:
description: Email address of the person responsible for the domain.
description: |
Email address of the person responsible for the domain.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
neutron-record-format:
type: string
default: '%(octet0)s-%(octet1)s-%(octet2)s-%(octet3)s.%(zone)s'
description: Format of floating IP global records.
description: |
Format of floating IP global records.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
neutron-record-formatv6:
type: string
default: '%(hostname)s.%(tenant_id)s.%(zone)s'
description: Format of floating IPv6 global records.
description: |
Format of floating IPv6 global records.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
nova-record-format:
type: string
default: '%(hostname)s.%(tenant_id)s.%(zone)s'
description: Format of instance IPv4 global records.
description: |
Format of floating IP global records.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
nova-record-formatv6:
type: string
default: '%(hostname)s.%(tenant_id)s.%(zone)s'
description: Format of floating IPv6 global records.
description: |
Format of floating IPv6 global records.
(NOTE: This option is obsolete starting from OpenStack Mitaka release)
enable-host-header:
type: boolean
default: false

View File

@ -1,4 +1,4 @@
includes: ['layer:openstack-api', 'interface:bind-rndc', 'interface:hacluster', 'interface:openstack-ha', 'interface:memcache']
includes: ['layer:openstack-api', 'interface:bind-rndc', 'interface:hacluster', 'interface:openstack-ha', 'interface:memcache', 'interface:designate']
options:
basic:
use_venv: True

View File

@ -201,6 +201,12 @@ def cluster_connected(hacluster):
instance.configure_ha_resources(hacluster)
@reactive.when('dnsaas.connected')
def expose_endpoint(endpoint):
with provide_charm_instance() as instance:
endpoint.expose_endpoint(instance.public_url)
@reactive.when_not('dont-set-assess-status')
def run_assess_status_on_every_hook():
"""The call to charm instance.assess_status() sets up the assess status

View File

@ -69,7 +69,8 @@ class DesignateBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
{'name': 'rabbitmq-server'},
{'name': 'keystone'},
{'name': 'memcached', 'location': 'cs:memcached'},
{'name': 'designate-bind'}
{'name': 'designate-bind'},
{'name': 'neutron-api'}
]
use_source = [
@ -96,6 +97,9 @@ class DesignateBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
'keystone:shared-db': 'percona-cluster:shared-db',
'designate:dns-backend': 'designate-bind:dns-backend',
'designate:coordinator-memcached': 'memcached:cache',
'designate:dnsaas': 'neutron-api:external-dns',
'neutron-api:identity-service': 'keystone:identity-service',
'neutron-api:shared-db': 'percona-cluster:shared-db',
}
super(DesignateBasicDeployment, self)._add_relations(relations)
@ -128,6 +132,7 @@ class DesignateBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
self.pxc_sentry = self.d.sentry['percona-cluster'][0]
self.keystone_sentry = self.d.sentry['keystone'][0]
self.rabbitmq_sentry = self.d.sentry['rabbitmq-server'][0]
self.neutron_api_sentry = self.d.sentry['neutron-api'][0]
u.log.debug('openstack release val: {}'.format(
self._get_openstack_release()))
u.log.debug('openstack release str: {}'.format(
@ -380,6 +385,34 @@ class DesignateBasicDeployment(amulet_deployment.OpenStackAmuletDeployment):
message = u.relation_error('designate dns-backend', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_207_designate_neutron_api_relation(self):
"""Verify the designate to neutron-api relation data"""
u.log.debug('Checking designate:dnsaas relation data...')
unit = self.designate_sentry
relation = ['dnsaas', 'neutron-api:external-dns']
designate_ip = u.valid_ip
expected = {
'endpoint': u.valid_url,
'private-address': designate_ip,
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('designate dnsaas', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def test_208_neutron_api_designate_relation(self):
"""Verify the neutron-api to designate relation data"""
u.log.debug('Checking neutron-api:external-dns relation data...')
unit = self.neutron_api_sentry
relation = ['external-dns', 'designate:dnsaas']
expected = {
'private-address': u.valid_ip,
}
ret = u.validate_relation_data(unit, relation, expected)
if ret:
message = u.relation_error('neutron-api external-dns', ret)
amulet.raise_status(amulet.FAIL, msg=message)
def get_server_id(self, server_name):
server_id = None
for server in self.designate.servers.list():

View File

@ -34,6 +34,7 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
'run_db_migration': (
all_interfaces + ('base-config.rendered', )),
'configure_designate_basic': all_interfaces,
'expose_endpoint': ('dnsaas.connected', ),
},
'when_not': {
'setup_amqp_req': ('amqp.requested-access', ),