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
This commit is contained in:
Takashi Kajinami 2022-02-23 18:57:22 +09:00
parent 270d33d543
commit 2b9282bab6
3 changed files with 43 additions and 12 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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