From b93e88d0d61485dcd946df8c700d0216e839a7a2 Mon Sep 17 00:00:00 2001 From: Lewis Denny Date: Thu, 16 Jul 2020 16:55:19 +1000 Subject: [PATCH] Add support for the interface parameter in authtoken middleware This patch adds support for [keystone_authtoken] interface parameter, so that operators can define which endpoint should be used by authtoken middleware. Change-Id: I2e84c07cd0609d9636682326f70b9d366994205f (cherry picked from commit d733228e004d55ba758866dc5e503946bce30495) (cherry picked from commit f77f29b4eaca17dfe66ca41bd4ffaf1cd19c5e60) --- manifests/keystone/authtoken.pp | 7 +++++++ .../keystone-authtoken-interface-7d98af82eb230ebd.yaml | 5 +++++ spec/classes/sahara_keystone_authtoken_spec.rb | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/keystone-authtoken-interface-7d98af82eb230ebd.yaml diff --git a/manifests/keystone/authtoken.pp b/manifests/keystone/authtoken.pp index a34dae8c..a73b1861 100644 --- a/manifests/keystone/authtoken.pp +++ b/manifests/keystone/authtoken.pp @@ -168,6 +168,11 @@ # true/false # Defaults to $::os_service_default. # +# [*interface*] +# (Optional) Interface to use for the Identity API endpoint. Valid values are +# "public", "internal" or "admin". +# Defaults to $::os_service_default. +# class sahara::keystone::authtoken( $username = 'sahara', $password = $::os_service_default, @@ -202,6 +207,7 @@ class sahara::keystone::authtoken( $region_name = $::os_service_default, $token_cache_time = $::os_service_default, $service_token_roles_required = $::os_service_default, + $interface = $::os_service_default, ) { include ::sahara::deps @@ -240,6 +246,7 @@ class sahara::keystone::authtoken( region_name => $region_name, token_cache_time => $token_cache_time, service_token_roles_required => $service_token_roles_required, + interface => $interface, } sahara_config { diff --git a/releasenotes/notes/keystone-authtoken-interface-7d98af82eb230ebd.yaml b/releasenotes/notes/keystone-authtoken-interface-7d98af82eb230ebd.yaml new file mode 100644 index 00000000..572e5d7f --- /dev/null +++ b/releasenotes/notes/keystone-authtoken-interface-7d98af82eb230ebd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``sahara::keystone::authtoken::interface`` parameter has been added, + which can be used to set the interface parameter in authtoken middleware. diff --git a/spec/classes/sahara_keystone_authtoken_spec.rb b/spec/classes/sahara_keystone_authtoken_spec.rb index a84f49f3..93c2c5b6 100644 --- a/spec/classes/sahara_keystone_authtoken_spec.rb +++ b/spec/classes/sahara_keystone_authtoken_spec.rb @@ -43,6 +43,7 @@ describe 'sahara::keystone::authtoken' do is_expected.to contain_sahara_config('keystone_authtoken/region_name').with_value('') is_expected.to contain_sahara_config('keystone_authtoken/token_cache_time').with_value('') is_expected.to contain_sahara_config('keystone_authtoken/service_token_roles_required').with_value('') + is_expected.to contain_sahara_config('keystone_authtoken/interface').with_value('') is_expected.to contain_sahara_config('trustee/username').with_value('sahara') is_expected.to contain_sahara_config('trustee/password').with_value('sahara_password') is_expected.to contain_sahara_config('trustee/auth_url').with_value('http://127.0.0.1:5000/') @@ -90,6 +91,7 @@ describe 'sahara::keystone::authtoken' do :region_name => 'region2', :token_cache_time => '301', :service_token_roles_required => false, + :interface => 'internal', }) end @@ -126,6 +128,7 @@ describe 'sahara::keystone::authtoken' do is_expected.to contain_sahara_config('keystone_authtoken/region_name').with_value(params[:region_name]) is_expected.to contain_sahara_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time]) is_expected.to contain_sahara_config('keystone_authtoken/service_token_roles_required').with_value(params[:service_token_roles_required]) + is_expected.to contain_sahara_config('keystone_authtoken/interface').with_value(params[:interface]) is_expected.to contain_sahara_config('trustee/username').with_value(params[:username]) is_expected.to contain_sahara_config('trustee/password').with_value(params[:password]).with_secret(true) is_expected.to contain_sahara_config('trustee/auth_url').with_value(params[:auth_url])