Add api_v1_enabled and api_v2_enabled options

Adds the api_v1_enabled and api_v2_enabled config options.

Change-Id: I1744d44e4f7fb0cf2fe4f916b46076554abf2ba7
(cherry picked from commit 6e7daccea4)
This commit is contained in:
Tobias Urdin 2018-08-29 18:21:22 +02:00
parent 8e47326a0b
commit da8accd361
3 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,14 @@
# (optional) The handler that the API communicates with
# Defaults to $::os_service_default
#
# [*api_v1_enabled*]
# (optional) Boolean if V1 API should be enabled.
# Defaults to $::os_service_default
#
# [*api_v2_enabled*]
# (optional) Boolean if V2 API should be enabled.
# Defaults to $::os_service_default
#
# [*allow_tls_terminated_listeners*]
# (optional) Boolean if we allow creation of TLS terminated listeners.
# Defaults to $::os_service_default
@ -46,6 +54,8 @@ class octavia::api (
$port = '9876',
$auth_strategy = 'keystone',
$api_handler = $::os_service_default,
$api_v1_enabled = $::os_service_default,
$api_v2_enabled = $::os_service_default,
$allow_tls_terminated_listeners = $::os_service_default,
$sync_db = false,
) inherits octavia::params {
@ -90,6 +100,8 @@ class octavia::api (
'api_settings/bind_port': value => $port;
'api_settings/auth_strategy': value => $auth_strategy;
'api_settings/api_handler': value => $api_handler;
'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;
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new parameters octavia::api::api_v1_enabled and api_v2_enabled that
can be used for enable/disable the API versions.

View File

@ -18,6 +18,8 @@ describe 'octavia::api' do
:port => '9876',
:host => '0.0.0.0',
:api_handler => 'queue_producer',
:api_v1_enabled => true,
:api_v2_enabled => true,
:allow_tls_terminated_listeners => false,
}
end
@ -46,6 +48,8 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/bind_port').with_value( '9876' )
is_expected.to contain_octavia_config('api_settings/auth_strategy').with_value( 'keystone' )
is_expected.to contain_octavia_config('api_settings/api_handler').with_value('<SERVICE DEFAULT>')
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>')
end
it 'does not sync the database' do
@ -57,6 +61,8 @@ describe 'octavia::api' do
is_expected.to contain_octavia_config('api_settings/bind_host').with_value( params[:host] )
is_expected.to contain_octavia_config('api_settings/bind_port').with_value( params[:port] )
is_expected.to contain_octavia_config('api_settings/api_handler').with_value( params[:api_handler] )
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] )
end