Merge "Use ctlplane for internal QDR communication"

This commit is contained in:
Zuul 2020-02-02 01:15:48 +00:00 committed by Gerrit Code Review
commit 6468651b27
3 changed files with 39 additions and 45 deletions

View File

@ -84,6 +84,11 @@
# (optional) Comma separated list of controller nodes' fqdns # (optional) Comma separated list of controller nodes' fqdns
# Defaults to hiera('controller_node_names', '') # Defaults to hiera('controller_node_names', '')
# #
# [*interior_ip*]
# (optional) IP address which should be used for internal communication.
# Has to be member of interior_mesh_nodes
# Defaults to hiera('ctlplane', undef)
#
# [*connectors*] # [*connectors*]
# (optional) List of hashes containing configuration for outgoing connections # (optional) List of hashes containing configuration for outgoing connections
# from the router. Each hash should contain 'host', 'role' and 'port' key. # from the router. Each hash should contain 'host', 'role' and 'port' key.
@ -131,6 +136,7 @@ class tripleo::profile::base::metrics::qdr (
$listener_ssl_password = undef, $listener_ssl_password = undef,
$listener_trusted_certs = undef, $listener_trusted_certs = undef,
$interior_mesh_nodes = hiera('controller_node_ips', ''), $interior_mesh_nodes = hiera('controller_node_ips', ''),
$interior_ip = hiera('ctlplane', undef),
$connectors = [], $connectors = [],
$ssl_profiles = [], $ssl_profiles = [],
$ssl_internal_profile_name = undef, $ssl_internal_profile_name = undef,
@ -165,9 +171,13 @@ class tripleo::profile::base::metrics::qdr (
# and don't provide any internal listener # and don't provide any internal listener
$internal_listeners = [] $internal_listeners = []
} else { } else {
# validate interior_ip
if ! ($interior_ip in $interior_nodes) {
fail("Value of interior_ip '${interior_ip}' is not member of interior_mesh_nodes '${interior_mesh_nodes}'.")
}
# provide listener for edge node and listener for other interior nodes (if required) # provide listener for edge node and listener for other interior nodes (if required)
$edge_listener = merge($node_base, $edge_listener = merge($node_base,
{'host' => $listener_addr, {'host' => $interior_ip,
'port' => '5668', 'port' => '5668',
'role' => 'edge', 'role' => 'edge',
'authenticatePeer' => 'no', 'authenticatePeer' => 'no',
@ -175,7 +185,7 @@ class tripleo::profile::base::metrics::qdr (
if length($interior_nodes) > 1 { if length($interior_nodes) > 1 {
$internal_listeners = [ $internal_listeners = [
$edge_listener, $edge_listener,
merge($node_base, {'host' => $listener_addr, merge($node_base, {'host' => $interior_ip,
'port' => '5667', 'port' => '5667',
'role' => 'inter-router', 'role' => 'inter-router',
'authenticatePeer' => 'no', 'authenticatePeer' => 'no',
@ -183,7 +193,7 @@ class tripleo::profile::base::metrics::qdr (
] ]
# build mesh with other interior nodes # build mesh with other interior nodes
$internal_connectors = $interior_nodes.reduce([]) |$memo, $node| { $internal_connectors = $interior_nodes.reduce([]) |$memo, $node| {
if $::hostname in $node { if strip($node) == strip($interior_ip) {
$memo << true $memo << true
} elsif true in $memo { } elsif true in $memo {
$memo $memo

View File

@ -30,9 +30,6 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3 node in edge-only mode' do context 'with step 3 node in edge-only mode' do
before do before do
facts.merge!({
:hostname => 'node.example.com',
})
params.merge!({ params.merge!({
:interior_mesh_nodes => '', :interior_mesh_nodes => '',
:router_mode => 'edge', :router_mode => 'edge',
@ -50,16 +47,13 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3, edge node with defined interior_node and explicit external connectors' do context 'with step 3, edge node with defined interior_node and explicit external connectors' do
before do before do
facts.merge!({
:hostname => 'edge-node.example.com',
})
params.merge!({ params.merge!({
:connectors => [ :connectors => [
{'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no', {'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}, 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'},
{'host' => 'saf-node2.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no', {'host' => 'saf-node2.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}], 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
:interior_mesh_nodes => 'interior-node.example.com,', :interior_mesh_nodes => '192.168.24.124,',
:router_mode => 'edge', :router_mode => 'edge',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })
@ -69,7 +63,7 @@ describe 'tripleo::profile::base::metrics::qdr' do
is_expected.to contain_class('qdr').with( is_expected.to contain_class('qdr').with(
:extra_listeners => [], :extra_listeners => [],
:connectors => [ :connectors => [
{'host' => 'interior-node.example.com','port' => '5668','role' => 'edge','verifyHostname' => false, {'host' => '192.168.24.124','port' => '5668','role' => 'edge','verifyHostname' => false,
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}], 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
) )
end end
@ -77,17 +71,14 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3, interior node with defined interior_node and explicit external connectors' do context 'with step 3, interior node with defined interior_node and explicit external connectors' do
before do before do
facts.merge!({
:hostname => 'interior-node.example.com',
})
params.merge!({ params.merge!({
:listener_addr => 'interior-node.example.com', :listener_addr => '172.17.1.1',
:connectors => [ :connectors => [
{'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no', {'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}, 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'},
{'host' => 'saf-node2.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no', {'host' => 'saf-node2.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}], 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
:interior_mesh_nodes => 'interior-node.example.com,', :interior_mesh_nodes => '192.168.24.123,',
:router_mode => 'interior', :router_mode => 'interior',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })
@ -96,7 +87,7 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should setup explicit connectors and edge listener' do it 'should setup explicit connectors and edge listener' do
is_expected.to contain_class('qdr').with( is_expected.to contain_class('qdr').with(
:extra_listeners => [ :extra_listeners => [
{'host' => 'interior-node.example.com','port' => '5668','role' => 'edge','authenticatePeer' => 'no', {'host' => '192.168.24.123','port' => '5668','role' => 'edge','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}], 'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
:connectors => [ :connectors => [
{'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no', {'host' => 'saf-node1.example.com','port' => '5666','role' => 'interior','authenticatePeer' => 'no',
@ -109,12 +100,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3 and three interior nodes, on node1' do context 'with step 3 and three interior nodes, on node1' do
before do before do
facts.merge!({
:hostname => 'node1.example.com',
})
params.merge!({ params.merge!({
:listener_addr => 'node1.example.com', :listener_addr => '172.17.1.1',
:interior_mesh_nodes => 'node1.example.com,node2.example.com,node3.example.com,', :interior_mesh_nodes => '192.168.24.1,192.168.24.2,192.168.24.3,',
:interior_ip => '192.168.24.1',
:router_mode => 'interior', :router_mode => 'interior',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })
@ -123,9 +112,9 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set edge listener, interior listener and no connectors' do it 'should set edge listener, interior listener and no connectors' do
is_expected.to contain_class('qdr').with( is_expected.to contain_class('qdr').with(
:extra_listeners => [ :extra_listeners => [
{'sslProfile' => 'sslProfile', 'host' => 'node1.example.com', 'port' => '5668', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.1', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}, 'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node1.example.com', 'port' => '5667', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.1', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}], 'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [], :connectors => [],
) )
@ -134,12 +123,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3 and three interior nodes, on node2' do context 'with step 3 and three interior nodes, on node2' do
before do before do
facts.merge!({
:hostname => 'node2.example.com',
})
params.merge!({ params.merge!({
:listener_addr => 'node2.example.com', :listener_addr => '172.17.1.2',
:interior_mesh_nodes => 'node1.example.com,node2.example.com,node3.example.com,', :interior_mesh_nodes => '192.168.24.1,192.168.24.2,192.168.24.3,',
:interior_ip => '192.168.24.2',
:router_mode => 'interior', :router_mode => 'interior',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })
@ -148,12 +135,12 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set up edge listener, interior listener and one interior connector to node1' do it 'should set up edge listener, interior listener and one interior connector to node1' do
is_expected.to contain_class('qdr').with( is_expected.to contain_class('qdr').with(
:extra_listeners => [ :extra_listeners => [
{'sslProfile' => 'sslProfile', 'host' => 'node2.example.com', 'port' => '5668', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.2', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}, 'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node2.example.com', 'port' => '5667', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.2', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}], 'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [ :connectors => [
{'host' => 'node1.example.com','role' => 'inter-router','port' => '5667', {'host' => '192.168.24.1','role' => 'inter-router','port' => '5667',
'verifyHostname' => 'false','sslProfile' => 'sslProfile'}], 'verifyHostname' => 'false','sslProfile' => 'sslProfile'}],
) )
end end
@ -161,12 +148,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3 and three interior nodes, on node3' do context 'with step 3 and three interior nodes, on node3' do
before do before do
facts.merge!({
:hostname => 'node3.example.com',
})
params.merge!({ params.merge!({
:listener_addr => 'node3.example.com', :listener_addr => '172.17.1.3',
:interior_mesh_nodes => 'node1.example.com,node2.example.com,node3.example.com,', :interior_mesh_nodes => '192.168.24.1,192.168.24.2,192.168.24.3,',
:interior_ip => '192.168.24.3',
:router_mode => 'interior', :router_mode => 'interior',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })
@ -175,14 +160,14 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set up edge listener, interior listener and two interior connectors to node1 and node2' do it 'should set up edge listener, interior listener and two interior connectors to node1 and node2' do
is_expected.to contain_class('qdr').with( is_expected.to contain_class('qdr').with(
:extra_listeners => [ :extra_listeners => [
{'sslProfile' => 'sslProfile', 'host' => 'node3.example.com', 'port' => '5668', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.3', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}, 'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node3.example.com', 'port' => '5667', {'sslProfile' => 'sslProfile', 'host' => '192.168.24.3', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}], 'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [ :connectors => [
{"host"=>"node1.example.com", "role"=>"inter-router", "port"=>"5667", {"host"=>"192.168.24.1", "role"=>"inter-router", "port"=>"5667",
"verifyHostname" => 'false',"sslProfile" => "sslProfile"}, "verifyHostname" => 'false',"sslProfile" => "sslProfile"},
{"host"=>"node2.example.com", "role"=>"inter-router", "port"=>"5667", {"host"=>"192.168.24.2", "role"=>"inter-router", "port"=>"5667",
"verifyHostname" => 'false',"sslProfile" => "sslProfile"}], "verifyHostname" => 'false',"sslProfile" => "sslProfile"}],
) )
end end
@ -190,11 +175,8 @@ describe 'tripleo::profile::base::metrics::qdr' do
context 'with step 3 and three interior nodes, on edge node' do context 'with step 3 and three interior nodes, on edge node' do
before do before do
facts.merge!({
:hostname => 'edge.example.com',
})
params.merge!({ params.merge!({
:interior_mesh_nodes => 'node1.example.com,node2.example.com,node3.example.com,', :interior_mesh_nodes => '192.168.24.1,192.168.24.2,192.168.24.3,',
:router_mode => 'edge', :router_mode => 'edge',
:ssl_internal_profile_name => 'sslProfile', :ssl_internal_profile_name => 'sslProfile',
}) })

View File

@ -172,3 +172,5 @@ neutron::plugins::ovs::opendaylight::odl_username: 'admin'
neutron::plugins::ovs::opendaylight::odl_password: 'admin' neutron::plugins::ovs::opendaylight::odl_password: 'admin'
# swift related # swift related
swift_proxy_short_bootstrap_node_name: node swift_proxy_short_bootstrap_node_name: node
# required for metrics::qdr_user
ctlplane: '192.168.24.123'