From 3d53beb6f6e2c26dabc564b0905997f1b413a2e9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 29 Jun 2021 12:23:22 +0900 Subject: [PATCH] Octavia: Add optional inclusion of driver_agent class ... so that we can maintain all of class inclusions in puppet-tripleo. Change-Id: Ia90921a840a1dd0dad7d6617d123c59e79f803bf --- manifests/profile/base/octavia.pp | 11 +++- .../tripleo_profile_base_octavia_spec.rb | 59 +++++++++++++++---- 2 files changed, 56 insertions(+), 14 deletions(-) diff --git a/manifests/profile/base/octavia.pp b/manifests/profile/base/octavia.pp index 6e2aa43f1..76c0d8bf7 100644 --- a/manifests/profile/base/octavia.pp +++ b/manifests/profile/base/octavia.pp @@ -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 + } } } diff --git a/spec/classes/tripleo_profile_base_octavia_spec.rb b/spec/classes/tripleo_profile_base_octavia_spec.rb index a6aa90264..40aa8ac19 100644 --- a/spec/classes/tripleo_profile_base_octavia_spec.rb +++ b/spec/classes/tripleo_profile_base_octavia_spec.rb @@ -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|