Add support for designate driver
Change-Id: I3e5f87805feda47df93798d271cec843e86f3ce3
This commit is contained in:
parent
81574ff532
commit
a97d1e2db1
101
manifests/designate.pp
Normal file
101
manifests/designate.pp
Normal file
@ -0,0 +1,101 @@
|
||||
# == Class: neutron::designate
|
||||
#
|
||||
# Configure the Neutron designate DNS driver
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*password*]
|
||||
# (required) Password for connection to designate in admin context.
|
||||
#
|
||||
# [*url*]
|
||||
# (required) URL to the designate service.
|
||||
#
|
||||
# [*auth_type*]
|
||||
# (optional) An authentication type to use with an OpenStack Identity server.
|
||||
# The value should contain auth plugin name
|
||||
# Defaults to 'password'
|
||||
#
|
||||
# [*username*]
|
||||
# (optional) Username for connection to designate in admin context
|
||||
# Defaults to 'neutron'
|
||||
#
|
||||
# [*project_id*]
|
||||
# (optional) The UUID of the admin designate project. If provided this takes
|
||||
# precedence over project_name.
|
||||
#
|
||||
# [*project_name*]
|
||||
# (optional) The name of the admin project
|
||||
# Defaults to 'services'
|
||||
#
|
||||
# [*project_domain_id*]
|
||||
# (optional) Nova project's domain ID
|
||||
# Defaults to 'default'
|
||||
#
|
||||
# [*project_domain_name*]
|
||||
# (Optional) Name of domain for $project_name
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*user_domain_id*]
|
||||
# (optional) User's domain ID for connection to designate in admin context
|
||||
# Defaults to 'default'
|
||||
#
|
||||
# [*user_domain_name*]
|
||||
# (Optional) Name of domain for $username
|
||||
# Defaults to 'Default'
|
||||
#
|
||||
# [*auth_url*]
|
||||
# (optional) Authorization URI for connection to designate in admin context.
|
||||
# If version independent identity plugin is used available versions will be
|
||||
# determined using auth_url
|
||||
# Defaults to 'http://127.0.0.1:5000'
|
||||
#
|
||||
# [*allow_reverse_dns_lookup*]
|
||||
# (optional) Enable or not the creation of reverse lookup (PTR) records.
|
||||
#
|
||||
# [*ipv4_ptr_zone_prefix_size*]
|
||||
# (optional) Enable or not the creation of reverse lookup (PTR) records.
|
||||
#
|
||||
# [*ipv6_ptr_zone_prefix_size*]
|
||||
# (optional) Enable or not the creation of reverse lookup (PTR) records.
|
||||
#
|
||||
# [*ptr_zone_email*]
|
||||
# (optional) The email address to be used when creating PTR zones.
|
||||
#
|
||||
class neutron::designate (
|
||||
$password,
|
||||
$url,
|
||||
$auth_type = 'password',
|
||||
$username = 'neutron',
|
||||
$project_id = $::os_service_default,
|
||||
$project_name = 'services',
|
||||
$project_domain_id = 'default',
|
||||
$project_domain_name = 'Default',
|
||||
$user_domain_id = 'default',
|
||||
$user_domain_name = 'Default',
|
||||
$auth_url = 'http://127.0.0.1:5000',
|
||||
$allow_reverse_dns_lookup = $::os_service_default,
|
||||
$ipv4_ptr_zone_prefix_size = $::os_service_default,
|
||||
$ipv6_ptr_zone_prefix_size = $::os_service_default,
|
||||
$ptr_zone_email = $::os_service_default,
|
||||
) {
|
||||
include ::neutron::deps
|
||||
include ::neutron::params
|
||||
|
||||
neutron_config {
|
||||
'designate/password': value => $password;
|
||||
'designate/url': value => $url;
|
||||
'designate/auth_type': value => $auth_type;
|
||||
'designate/username': value => $username;
|
||||
'designate/project_id': value => $project_id;
|
||||
'designate/project_name': value => $project_name;
|
||||
'designate/project_domain_id': value => $project_domain_id;
|
||||
'designate/project_domain_name': value => $project_domain_name;
|
||||
'designate/user_domain_id': value => $user_domain_id;
|
||||
'designate/user_domain_name': value => $user_domain_name;
|
||||
'designate/auth_url': value => $auth_url;
|
||||
'designate/allow_reverse_dns_lookup': value => $allow_reverse_dns_lookup;
|
||||
'designate/ipv4_ptr_zone_prefix_size': value => $ipv4_ptr_zone_prefix_size;
|
||||
'designate/ipv6_ptr_zone_prefix_size': value => $ipv6_ptr_zone_prefix_size;
|
||||
'designate/ptr_zone_email': value => $ptr_zone_email;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Support setting up the designate DNS driver.
|
75
spec/classes/neutron_designate_spec.rb
Normal file
75
spec/classes/neutron_designate_spec.rb
Normal file
@ -0,0 +1,75 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::designate' do
|
||||
|
||||
let :req_params do
|
||||
{ :password => 'secret',
|
||||
:url => 'http://ip/designate' }
|
||||
end
|
||||
|
||||
shared_examples_for 'neutron designate' do
|
||||
context 'with default parameters' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'configures designate in neutron.conf' do
|
||||
is_expected.to contain_neutron_config('designate/url').with_value('http://ip/designate')
|
||||
is_expected.to contain_neutron_config('designate/password').with_value('secret')
|
||||
is_expected.to contain_neutron_config('designate/username').with_value('neutron')
|
||||
is_expected.to contain_neutron_config('designate/auth_type').with_value('password')
|
||||
is_expected.to contain_neutron_config('designate/project_name').with_value('services')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with provided parameters' do
|
||||
let :params do
|
||||
req_params.merge!({
|
||||
:auth_type => 'token',
|
||||
:username => 'user',
|
||||
:project_id => 'id1',
|
||||
:project_name => 'proj',
|
||||
:project_domain_id => 'domain1',
|
||||
:project_domain_name => 'Domain1',
|
||||
:user_domain_id => 'domain2',
|
||||
:user_domain_name => 'Domain2',
|
||||
:auth_url => 'http://auth/',
|
||||
:allow_reverse_dns_lookup => false,
|
||||
:ipv4_ptr_zone_prefix_size => 765,
|
||||
:ipv6_ptr_zone_prefix_size => 876,
|
||||
:ptr_zone_email => 'foo@example.com'
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures designate in neutron.conf' do
|
||||
is_expected.to contain_neutron_config('designate/url').with_value('http://ip/designate')
|
||||
is_expected.to contain_neutron_config('designate/password').with_value('secret')
|
||||
is_expected.to contain_neutron_config('designate/username').with_value('user')
|
||||
is_expected.to contain_neutron_config('designate/auth_type').with_value('token')
|
||||
is_expected.to contain_neutron_config('designate/project_id').with_value('id1')
|
||||
is_expected.to contain_neutron_config('designate/project_name').with_value('proj')
|
||||
is_expected.to contain_neutron_config('designate/project_domain_id').with_value('domain1')
|
||||
is_expected.to contain_neutron_config('designate/project_domain_name').with_value('Domain1')
|
||||
is_expected.to contain_neutron_config('designate/user_domain_id').with_value('domain2')
|
||||
is_expected.to contain_neutron_config('designate/user_domain_name').with_value('Domain2')
|
||||
is_expected.to contain_neutron_config('designate/auth_url').with_value('http://auth/')
|
||||
is_expected.to contain_neutron_config('designate/allow_reverse_dns_lookup').with_value(false)
|
||||
is_expected.to contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value(765)
|
||||
is_expected.to contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value(876)
|
||||
is_expected.to contain_neutron_config('designate/ptr_zone_email').with_value('foo@example.com')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'neutron designate'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user