diff --git a/manifests/api.pp b/manifests/api.pp index fbde3830..c51c202a 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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; } } diff --git a/releasenotes/notes/add-provider-driver-config-9f5352879efe3f9d.yaml b/releasenotes/notes/add-provider-driver-config-9f5352879efe3f9d.yaml new file mode 100644 index 00000000..39d96b82 --- /dev/null +++ b/releasenotes/notes/add-provider-driver-config-9f5352879efe3f9d.yaml @@ -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. diff --git a/spec/classes/octavia_api_spec.rb b/spec/classes/octavia_api_spec.rb index 0f89c45d..3badc2b3 100644 --- a/spec/classes/octavia_api_spec.rb +++ b/spec/classes/octavia_api_spec.rb @@ -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('') is_expected.to contain_octavia_config('api_settings/api_v2_enabled').with_value('') is_expected.to contain_octavia_config('api_settings/allow_tls_terminated_listeners').with_value('') + is_expected.to contain_octavia_config('api_settings/default_provider_driver').with_value('') + is_expected.to contain_octavia_config('api_settings/enabled_provider_drivers').with_value('') 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|