From edfe3e546009dec4c6c5bdcfbb4d5902eaed82c9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 12 Apr 2020 21:51:54 +0900 Subject: [PATCH] Add region_name parameter for service authentication ... so that operators can use their customized region_name. Change-Id: If923077e1e437ccadcb4b8773cd81f46479876dc --- manifests/cinder.pp | 7 +++++++ manifests/glance.pp | 7 +++++++ manifests/neutron.pp | 7 +++++++ manifests/swift.pp | 7 +++++++ .../notes/keystone-region_name-6e25c084e4a0b711.yaml | 10 ++++++++++ spec/classes/ironic_cinder_spec.rb | 3 +++ spec/classes/ironic_glance_spec.rb | 3 +++ spec/classes/ironic_neutron_spec.rb | 3 +++ spec/classes/ironic_swift_spec.rb | 3 +++ 9 files changed, 50 insertions(+) create mode 100644 releasenotes/notes/keystone-region_name-6e25c084e4a0b711.yaml diff --git a/manifests/cinder.pp b/manifests/cinder.pp index 7b64f2f4..f51723a1 100644 --- a/manifests/cinder.pp +++ b/manifests/cinder.pp @@ -40,6 +40,11 @@ # The name of project's domain (required for Identity V3). # Defaults to 'Default' # +# [*region_name*] +# (optional) Region name for connecting to cinder in admin context +# through the OpenStack Identity service. +# Defaults to $::os_service_default +# # [*endpoint_override*] # The endpoint URL for requests for this client # Defaults to $::os_service_default @@ -52,6 +57,7 @@ class ironic::cinder ( $password = $::os_service_default, $user_domain_name = 'Default', $project_domain_name = 'Default', + $region_name = $::os_service_default, $endpoint_override = $::os_service_default, ) { @@ -63,6 +69,7 @@ class ironic::cinder ( 'cinder/project_name': value => $project_name; 'cinder/user_domain_name': value => $user_domain_name; 'cinder/project_domain_name': value => $project_domain_name; + 'cinder/region_name': value => $region_name; 'cinder/endpoint_override': value => $endpoint_override; } } diff --git a/manifests/glance.pp b/manifests/glance.pp index 41e8b7d9..098dcc6c 100644 --- a/manifests/glance.pp +++ b/manifests/glance.pp @@ -40,6 +40,11 @@ # The name of project's domain (required for Identity V3). # Defaults to 'Default' # +# [*region_name*] +# (optional) Region name for connecting to glance in admin context +# through the OpenStack Identity service. +# Defaults to $::os_service_default +# # [*num_retries*] # (optional) Number retries when downloading an image from glance. # Defaults to $::os_service_default @@ -98,6 +103,7 @@ class ironic::glance ( $password = $::os_service_default, $user_domain_name = 'Default', $project_domain_name = 'Default', + $region_name = $::os_service_default, $num_retries = $::os_service_default, $api_insecure = $::os_service_default, $swift_account = $::os_service_default, @@ -128,6 +134,7 @@ has no effect. Please use ironic::glance::endpoint_override instead.") 'glance/project_name': value => $project_name; 'glance/user_domain_name': value => $user_domain_name; 'glance/project_domain_name': value => $project_domain_name; + 'glance/region_name': value => $region_name; 'glance/num_retries': value => $num_retries; 'glance/insecure': value => $api_insecure; 'glance/swift_container': value => $swift_container; diff --git a/manifests/neutron.pp b/manifests/neutron.pp index cdbdbed3..f78c834c 100644 --- a/manifests/neutron.pp +++ b/manifests/neutron.pp @@ -40,6 +40,11 @@ # The name of project's domain (required for Identity V3). # Defaults to 'Default' # +# [*region_name*] +# (optional) Region name for connecting to neutron in admin context +# through the OpenStack Identity service. +# Defaults to $::os_service_default +# # [*endpoint_override*] # The endpoint URL for requests for this client # Defaults to $::os_service_default @@ -58,6 +63,7 @@ class ironic::neutron ( $password = $::os_service_default, $user_domain_name = 'Default', $project_domain_name = 'Default', + $region_name = $::os_service_default, $endpoint_override = $::os_service_default, # DEPRECATED PARAMETERS $api_endpoint = undef, @@ -76,6 +82,7 @@ has no effect. Please use ironic::neutron::endpoint_override instead.") 'neutron/project_name': value => $project_name; 'neutron/user_domain_name': value => $user_domain_name; 'neutron/project_domain_name': value => $project_domain_name; + 'neutron/region_name': value => $region_name; 'neutron/endpoint_override': value => $endpoint_override; } } diff --git a/manifests/swift.pp b/manifests/swift.pp index d8da0578..0484fc25 100644 --- a/manifests/swift.pp +++ b/manifests/swift.pp @@ -40,6 +40,11 @@ # The name of project's domain (required for Identity V3). # Defaults to 'Default' # +# [*region_name*] +# (optional) Region name for connecting to swift in admin context +# through the OpenStack Identity service. +# Defaults to $::os_service_default +# # [*endpoint_override*] # The endpoint URL for requests for this client # Defaults to $::os_service_default @@ -52,6 +57,7 @@ class ironic::swift ( $password = $::os_service_default, $user_domain_name = 'Default', $project_domain_name = 'Default', + $region_name = $::os_service_default, $endpoint_override = $::os_service_default, ) { @@ -63,6 +69,7 @@ class ironic::swift ( 'swift/project_name': value => $project_name; 'swift/user_domain_name': value => $user_domain_name; 'swift/project_domain_name': value => $project_domain_name; + 'swift/region_name': value => $region_name; 'swift/endpoint_override': value => $endpoint_override; } } diff --git a/releasenotes/notes/keystone-region_name-6e25c084e4a0b711.yaml b/releasenotes/notes/keystone-region_name-6e25c084e4a0b711.yaml new file mode 100644 index 00000000..a0715e3b --- /dev/null +++ b/releasenotes/notes/keystone-region_name-6e25c084e4a0b711.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + The following parameters were added so that operatos can specify + the keystone region where identity resources are created. + + - ``ironic::cinder::region_name`` + - ``ironic::glance::region_name`` + - ``ironic::neutron::region_name`` + - ``ironic::swift::region_name`` diff --git a/spec/classes/ironic_cinder_spec.rb b/spec/classes/ironic_cinder_spec.rb index d32dfe7c..60cd1b35 100644 --- a/spec/classes/ironic_cinder_spec.rb +++ b/spec/classes/ironic_cinder_spec.rb @@ -41,6 +41,7 @@ describe 'ironic::cinder' do is_expected.to contain_ironic_config('cinder/password').with_value('').with_secret(true) is_expected.to contain_ironic_config('cinder/user_domain_name').with_value('Default') is_expected.to contain_ironic_config('cinder/project_domain_name').with_value('Default') + is_expected.to contain_ironic_config('cinder/region_name').with_value('') is_expected.to contain_ironic_config('cinder/endpoint_override').with_value('') end @@ -54,6 +55,7 @@ describe 'ironic::cinder' do :password => 'pa$$w0rd', :user_domain_name => 'NonDefault', :project_domain_name => 'NonDefault', + :region_name => 'regionTwo', :endpoint_override => 'http://example2.com', ) end @@ -66,6 +68,7 @@ describe 'ironic::cinder' do is_expected.to contain_ironic_config('cinder/password').with_value(p[:password]).with_secret(true) is_expected.to contain_ironic_config('cinder/user_domain_name').with_value(p[:user_domain_name]) is_expected.to contain_ironic_config('cinder/project_domain_name').with_value(p[:project_domain_name]) + is_expected.to contain_ironic_config('cinder/region_name').with_value(p[:region_name]) is_expected.to contain_ironic_config('cinder/endpoint_override').with_value(p[:endpoint_override]) end end diff --git a/spec/classes/ironic_glance_spec.rb b/spec/classes/ironic_glance_spec.rb index b449cd00..c8a9a95a 100644 --- a/spec/classes/ironic_glance_spec.rb +++ b/spec/classes/ironic_glance_spec.rb @@ -41,6 +41,7 @@ describe 'ironic::glance' do is_expected.to contain_ironic_config('glance/password').with_value('').with_secret(true) is_expected.to contain_ironic_config('glance/user_domain_name').with_value('Default') is_expected.to contain_ironic_config('glance/project_domain_name').with_value('Default') + is_expected.to contain_ironic_config('glance/region_name').with_value('') is_expected.to contain_ironic_config('glance/insecure').with_value('') is_expected.to contain_ironic_config('glance/num_retries').with_value('') is_expected.to contain_ironic_config('glance/swift_account').with(:value => '') @@ -61,6 +62,7 @@ describe 'ironic::glance' do :password => 'pa$$w0rd', :user_domain_name => 'NonDefault', :project_domain_name => 'NonDefault', + :region_name => 'regionTwo', :api_servers => '10.0.0.1:9292', :api_insecure => true, :num_retries => 42, @@ -81,6 +83,7 @@ describe 'ironic::glance' do is_expected.to contain_ironic_config('glance/password').with_value(p[:password]).with_secret(true) is_expected.to contain_ironic_config('glance/user_domain_name').with_value(p[:user_domain_name]) is_expected.to contain_ironic_config('glance/project_domain_name').with_value(p[:project_domain_name]) + is_expected.to contain_ironic_config('glance/region_name').with_value(p[:region_name]) is_expected.to contain_ironic_config('glance/insecure').with_value(p[:api_insecure]) is_expected.to contain_ironic_config('glance/num_retries').with_value(p[:num_retries]) is_expected.to contain_ironic_config('glance/swift_account').with_value(p[:swift_account]) diff --git a/spec/classes/ironic_neutron_spec.rb b/spec/classes/ironic_neutron_spec.rb index ff7a4879..9b296695 100644 --- a/spec/classes/ironic_neutron_spec.rb +++ b/spec/classes/ironic_neutron_spec.rb @@ -41,6 +41,7 @@ describe 'ironic::neutron' do is_expected.to contain_ironic_config('neutron/password').with_value('').with_secret(true) is_expected.to contain_ironic_config('neutron/user_domain_name').with_value('Default') is_expected.to contain_ironic_config('neutron/project_domain_name').with_value('Default') + is_expected.to contain_ironic_config('neutron/region_name').with_value('') is_expected.to contain_ironic_config('neutron/endpoint_override').with_value('') end @@ -54,6 +55,7 @@ describe 'ironic::neutron' do :password => 'pa$$w0rd', :user_domain_name => 'NonDefault', :project_domain_name => 'NonDefault', + :region_name => 'regionTwo', :endpoint_override => 'http://example2.com', ) end @@ -66,6 +68,7 @@ describe 'ironic::neutron' do is_expected.to contain_ironic_config('neutron/password').with_value(p[:password]).with_secret(true) is_expected.to contain_ironic_config('neutron/user_domain_name').with_value(p[:user_domain_name]) is_expected.to contain_ironic_config('neutron/project_domain_name').with_value(p[:project_domain_name]) + is_expected.to contain_ironic_config('neutron/region_name').with_value(p[:region_name]) is_expected.to contain_ironic_config('neutron/endpoint_override').with_value(p[:endpoint_override]) end end diff --git a/spec/classes/ironic_swift_spec.rb b/spec/classes/ironic_swift_spec.rb index 80e05e8a..1564bf1d 100644 --- a/spec/classes/ironic_swift_spec.rb +++ b/spec/classes/ironic_swift_spec.rb @@ -41,6 +41,7 @@ describe 'ironic::swift' do is_expected.to contain_ironic_config('swift/password').with_value('').with_secret(true) is_expected.to contain_ironic_config('swift/user_domain_name').with_value('Default') is_expected.to contain_ironic_config('swift/project_domain_name').with_value('Default') + is_expected.to contain_ironic_config('swift/region_name').with_value('') is_expected.to contain_ironic_config('swift/endpoint_override').with_value('') end @@ -54,6 +55,7 @@ describe 'ironic::swift' do :password => 'pa$$w0rd', :user_domain_name => 'NonDefault', :project_domain_name => 'NonDefault', + :region_name => 'regionTwo', :endpoint_override => 'http://example2.com', ) end @@ -66,6 +68,7 @@ describe 'ironic::swift' do is_expected.to contain_ironic_config('swift/password').with_value(p[:password]).with_secret(true) is_expected.to contain_ironic_config('swift/user_domain_name').with_value(p[:user_domain_name]) is_expected.to contain_ironic_config('swift/project_domain_name').with_value(p[:project_domain_name]) + is_expected.to contain_ironic_config('swift/region_name').with_value(p[:region_name]) is_expected.to contain_ironic_config('swift/endpoint_override').with_value(p[:endpoint_override]) end end