Add support for configuring provider drivers

Add support for configuring Octavia's load balancer provider drivers.

Change-Id: I30a070b3c68d11792b499ffe315e89cb082c1929
This commit is contained in:
Brent Eagles 2019-02-13 10:33:36 -03:30
parent a2aa65341e
commit 82ed79389b
3 changed files with 28 additions and 0 deletions

View File

@ -55,6 +55,14 @@
# (optional) Run octavia-db-manage upgrade head on api nodes after installing the package.
# Defaults to false
#
# [*default_provider_driver*]
# (optional) Configure the default provider driver.
# Defaults to $::os_service_default
#
# [*provider_drivers*]
# (optional) Configure the loadbalancer provider drivers.
# Defaults to $::os_service_default
#
class octavia::api (
$enabled = true,
$manage_service = true,
@ -68,12 +76,18 @@ class octavia::api (
$api_v2_enabled = $::os_service_default,
$allow_tls_terminated_listeners = $::os_service_default,
$sync_db = false,
$default_provider_driver = $::os_service_default,
$provider_drivers = $::os_service_default,
) inherits octavia::params {
include ::octavia::deps
include ::octavia::policy
include ::octavia::db
if !is_service_default($provider_drivers) {
validate_hash($provider_drivers)
}
if $auth_strategy == 'keystone' {
include ::octavia::keystone::authtoken
}
@ -125,6 +139,8 @@ class octavia::api (
'api_settings/api_v1_enabled': value => $api_v1_enabled;
'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;
}
}

View File

@ -0,0 +1,6 @@
---
features:
- |
Added octavia::api::provider_drivers and
octavia::api::default_provider_driver configuration to support configuring
different load balancer drivers in octavia.

View File

@ -11,6 +11,8 @@ describe 'octavia::api' do
:api_v1_enabled => true,
:api_v2_enabled => true,
:allow_tls_terminated_listeners => false,
:default_provider_driver => 'ovn',
:provider_drivers => { 'amphora' => 'Octavia Amphora Driver', 'ovn' => 'Octavia OVN driver' }
}
end
@ -49,6 +51,8 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/api_v1_enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('api_settings/api_v2_enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('api_settings/allow_tls_terminated_listeners').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('api_settings/default_provider_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value('<SERVICE DEFAULT>')
end
it 'does not sync the database' do
is_expected.not_to contain_class('octavia::db::sync')
@ -62,6 +66,8 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/api_v1_enabled').with_value( params[:api_v1_enabled] )
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] )
end
[{:enabled => true}, {:enabled => false}].each do |param_hash|