From da8accd3615bbc74315b45521224eb4c53455c04 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 29 Aug 2018 18:21:22 +0200 Subject: [PATCH] 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 6e7daccea4b0ceb3f9e9b5cbb6a51ae1d59b4b86) --- manifests/api.pp | 12 ++++++++++++ .../notes/api-v1-v2-options-393e026d4d22b94d.yaml | 5 +++++ spec/classes/octavia_api_spec.rb | 6 ++++++ 3 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/api-v1-v2-options-393e026d4d22b94d.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 7551afa7..26bc3356 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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; } diff --git a/releasenotes/notes/api-v1-v2-options-393e026d4d22b94d.yaml b/releasenotes/notes/api-v1-v2-options-393e026d4d22b94d.yaml new file mode 100644 index 00000000..99a68d69 --- /dev/null +++ b/releasenotes/notes/api-v1-v2-options-393e026d4d22b94d.yaml @@ -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. diff --git a/spec/classes/octavia_api_spec.rb b/spec/classes/octavia_api_spec.rb index 3a803187..232af692 100644 --- a/spec/classes/octavia_api_spec.rb +++ b/spec/classes/octavia_api_spec.rb @@ -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('') + 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('') 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