Merge "Octavia: Add optional inclusion of driver_agent class"

This commit is contained in:
Zuul 2021-08-27 22:50:29 +00:00 committed by Gerrit Code Review
commit 1e57a44c7a
2 changed files with 56 additions and 14 deletions

View File

@ -45,7 +45,11 @@
# [*oslomsg_rpc_use_ssl*]
# Enable ssl oslo messaging services
# Defaults to hiera('oslo_messaging_rpc_use_ssl', '0')
#
# [*enable_driver_agent*]
# Enable the driver agent
# Defaults to false
#
class tripleo::profile::base::octavia (
$step = Integer(hiera('step')),
$oslomsg_rpc_proto = hiera('oslo_messaging_rpc_scheme', 'rabbit'),
@ -54,6 +58,7 @@ class tripleo::profile::base::octavia (
$oslomsg_rpc_port = hiera('oslo_messaging_rpc_port', '5672'),
$oslomsg_rpc_username = hiera('oslo_messaging_rpc_user_name', 'guest'),
$oslomsg_rpc_use_ssl = hiera('oslo_messaging_rpc_use_ssl', '0'),
$enable_driver_agent = false
) {
if $step >= 3 {
$oslomsg_rpc_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_rpc_use_ssl)))
@ -71,5 +76,9 @@ class tripleo::profile::base::octavia (
include octavia::db
include octavia::logging
include octavia::service_auth
if $enable_driver_agent {
include octavia::driver_agent
}
}
}

View File

@ -35,6 +35,9 @@ describe 'tripleo::profile::base::octavia' do
is_expected.to_not contain_class('octavia')
is_expected.to_not contain_class('octavia::config')
is_expected.to_not contain_class('octavia::db')
is_expected.to_not contain_class('octavia::logging')
is_expected.to_not contain_class('octavia::service_auth')
is_expected.to_not contain_class('octavia::driver_agent')
end
end
@ -49,12 +52,18 @@ describe 'tripleo::profile::base::octavia' do
)
is_expected.to contain_class('octavia::config')
is_expected.to contain_class('octavia::db')
is_expected.to contain_class('octavia::logging')
is_expected.to contain_class('octavia::service_auth')
is_expected.to_not contain_class('octavia::driver_agent')
end
end
context 'with multiple hosts' do
before do
params.merge!({ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'] })
params.merge!({
:step => 3,
:oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com']
})
end
it 'should construct a multihost URL' do
@ -66,7 +75,10 @@ describe 'tripleo::profile::base::octavia' do
context 'with username provided' do
before do
params.merge!({ :oslomsg_rpc_username => 'bunny' })
params.merge!({
:step => 3,
:oslomsg_rpc_username => 'bunny'
})
end
it 'should construct URL with username' do
@ -78,11 +90,11 @@ describe 'tripleo::profile::base::octavia' do
context 'with username and password provided' do
before do
params.merge!(
{ :oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
}
)
params.merge!({
:step => 3,
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
})
end
it 'should construct URL with username and password' do
@ -94,12 +106,12 @@ describe 'tripleo::profile::base::octavia' do
context 'with multiple hosts and user info provided' do
before do
params.merge!(
{ :oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'],
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
}
)
params.merge!({
:step => 3,
:oslomsg_rpc_hosts => ['some.server.com', 'someother.server.com'],
:oslomsg_rpc_username => 'bunny',
:oslomsg_rpc_password => 'carrot'
})
end
it 'should distributed user info across hosts URL' do
@ -108,6 +120,27 @@ describe 'tripleo::profile::base::octavia' do
)
end
end
context 'with driver agent enabled' do
before do
params.merge!({
:step => 3,
:enable_driver_agent => true
})
end
it 'should provide basic initialization' do
is_expected.to contain_class('octavia').with(
:default_transport_url => 'rabbit://guest:password@some.server.com:5672/?ssl=0'
)
is_expected.to contain_class('octavia::config')
is_expected.to contain_class('octavia::db')
is_expected.to contain_class('octavia::logging')
is_expected.to contain_class('octavia::service_auth')
is_expected.to contain_class('octavia::driver_agent')
end
end
end
on_supported_os.each do |os, facts|