From 2b9282bab65d879b47c4a1065801e0e9d916ecad Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 23 Feb 2022 18:57:22 +0900 Subject: [PATCH] Use consistent name for enabled_provider_drivers This change renames the octavia::api::provider_drivers parameter so that the name is consistent with the parameter name in Octavia. Change-Id: Id0371d4f9dd4a4922deabae512153d9f9767bf55 --- manifests/api.pp | 26 ++++++++++++++----- ...ble_provider_drivers-db3b1fb5f07c4140.yaml | 5 ++++ spec/classes/octavia_api_spec.rb | 24 ++++++++++++----- 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/enable_provider_drivers-db3b1fb5f07c4140.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 8ca506dc..73979a3a 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -64,7 +64,7 @@ # (optional) Configure the default provider driver. # Defaults to $::os_service_default # -# [*provider_drivers*] +# [*enabled_provider_drivers*] # (optional) Configure the loadbalancer provider drivers. # Defaults to $::os_service_default # @@ -107,6 +107,12 @@ # (optional) Minimum allowed TLS version for listeners and pools. # Defaults to $::os_service_default # +# DEPRECATED PARAMETERS +# +# [*provider_drivers*] +# (optional) Configure the loadbalancer provider drivers. +# Defaults to undef +# class octavia::api ( $enabled = true, $manage_service = true, @@ -122,7 +128,7 @@ class octavia::api ( $sync_db = false, $enable_proxy_headers_parsing = $::os_service_default, $default_provider_driver = $::os_service_default, - $provider_drivers = $::os_service_default, + $enabled_provider_drivers = $::os_service_default, $pagination_max_limit = $::os_service_default, $healthcheck_enabled = $::os_service_default, $healthcheck_refresh_interval = $::os_service_default, @@ -132,12 +138,19 @@ class octavia::api ( $default_listener_tls_versions = $::os_service_default, $default_pool_tls_versions = $::os_service_default, $minimum_tls_version = $::os_service_default, + # DEPRECATED PARAMETERS + $provider_drivers = undef, ) inherits octavia::params { include octavia::deps include octavia::policy include octavia::db + if $provider_drivers != undef { + warning('The provider_drivers parameter is deprecated. \ +Use the enabled_provider_drivers parameter instead.') + } + if $auth_strategy == 'keystone' { include octavia::keystone::authtoken } @@ -180,10 +193,11 @@ class octavia::api ( include octavia::db::sync } - if $provider_drivers =~ Hash { - $provider_drivers_real = join(join_keys_to_values($provider_drivers, ':'), ',') + $enabled_provider_drivers_raw = pick($provider_drivers, $enabled_provider_drivers) + if $enabled_provider_drivers_raw =~ Hash { + $enabled_provider_drivers_real = join(join_keys_to_values($enabled_provider_drivers_raw, ':'), ',') } else { - $provider_drivers_real = join(any2array($provider_drivers), ',') + $enabled_provider_drivers_real = join(any2array($enabled_provider_drivers_raw), ',') } octavia_config { @@ -195,7 +209,7 @@ class octavia::api ( 'api_settings/api_v2_enabled': value => $api_v2_enabled; 'api_settings/allow_tls_terminated_listeners': value => $allow_tls_terminated_listeners; 'api_settings/default_provider_driver': value => $default_provider_driver; - 'api_settings/enabled_provider_drivers': value => $provider_drivers_real; + 'api_settings/enabled_provider_drivers': value => $enabled_provider_drivers_real; 'api_settings/pagination_max_limit': value => $pagination_max_limit; 'api_settings/healthcheck_enabled': value => $healthcheck_enabled; 'api_settings/healthcheck_refresh_interval': value => $healthcheck_refresh_interval; diff --git a/releasenotes/notes/enable_provider_drivers-db3b1fb5f07c4140.yaml b/releasenotes/notes/enable_provider_drivers-db3b1fb5f07c4140.yaml new file mode 100644 index 00000000..eed054a1 --- /dev/null +++ b/releasenotes/notes/enable_provider_drivers-db3b1fb5f07c4140.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The ``octavia::api::provider_drivers`` parameter has been deprecated in + favor of the new ``octavia::api::enabled_provider_drivers`` parameter. diff --git a/spec/classes/octavia_api_spec.rb b/spec/classes/octavia_api_spec.rb index a74485bd..fa0020d4 100644 --- a/spec/classes/octavia_api_spec.rb +++ b/spec/classes/octavia_api_spec.rb @@ -12,7 +12,7 @@ describe 'octavia::api' do :api_v2_enabled => true, :allow_tls_terminated_listeners => false, :default_provider_driver => 'ovn', - :provider_drivers => 'amphora:Octavia Amphora Driver,ovn:Octavia OVN driver', + :enabled_provider_drivers => 'amphora:Octavia Amphora driver,ovn:Octavia OVN driver', :pagination_max_limit => '1000', :healthcheck_enabled => true, :healthcheck_refresh_interval => 5, @@ -82,7 +82,7 @@ describe 'octavia::api' do is_expected.to contain_octavia_config('api_settings/api_v2_enabled').with_value( params[:api_v2_enabled] ) is_expected.to contain_octavia_config('api_settings/allow_tls_terminated_listeners').with_value( params[:allow_tls_terminated_listeners] ) is_expected.to contain_octavia_config('api_settings/default_provider_driver').with_value( params[:default_provider_driver] ) - is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value( params[:provider_drivers] ) + is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value( params[:enabled_provider_drivers] ) is_expected.to contain_octavia_config('api_settings/pagination_max_limit').with_value( params[:pagination_max_limit] ) is_expected.to contain_octavia_config('api_settings/healthcheck_enabled').with_value( params[:healthcheck_enabled] ) is_expected.to contain_octavia_config('api_settings/healthcheck_refresh_interval').with_value( params[:healthcheck_refresh_interval] ) @@ -180,10 +180,10 @@ describe 'octavia::api' do end end - context 'with provider_drivers in array' do + context 'with enabled_provider_drivers in array' do before do params.merge!({ - :provider_drivers => [ + :enabled_provider_drivers => [ 'amphora:Octavia Amphora driver', 'ovn:Octavia OVN driver' ] @@ -195,10 +195,10 @@ describe 'octavia::api' do end end - context 'with provider_drivers in hash' do + context 'with enabled_provider_drivers in hash' do before do params.merge!({ - :provider_drivers => { + :enabled_provider_drivers => { 'amphora' => 'Octavia Amphora driver', 'ovn' => 'Octavia OVN driver' } @@ -209,6 +209,18 @@ describe 'octavia::api' do .with_value('amphora:Octavia Amphora driver,ovn:Octavia OVN driver') end end + + context 'with deprecated provider_drivers in hash' do + before do + params.merge!({ + :provider_drivers => 'amphora:Octavia Amphora driver,ovn:Octavia OVN driver' + }) + end + it 'configures parameters' do + is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers')\ + .with_value('amphora:Octavia Amphora driver,ovn:Octavia OVN driver') + end + end end shared_examples 'octavia-api wsgi' do