Add region_name parameter for service authentication

... so that operators can use their customized region_name.

Change-Id: If923077e1e437ccadcb4b8773cd81f46479876dc
This commit is contained in:
Takashi Kajinami 2020-04-12 21:51:54 +09:00
parent e2b577a201
commit edfe3e5460
9 changed files with 50 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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``

View File

@ -41,6 +41,7 @@ describe 'ironic::cinder' do
is_expected.to contain_ironic_config('cinder/password').with_value('<SERVICE DEFAULT>').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('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('cinder/endpoint_override').with_value('<SERVICE DEFAULT>')
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

View File

@ -41,6 +41,7 @@ describe 'ironic::glance' do
is_expected.to contain_ironic_config('glance/password').with_value('<SERVICE DEFAULT>').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('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/num_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('glance/swift_account').with(:value => '<SERVICE DEFAULT>')
@ -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])

View File

@ -41,6 +41,7 @@ describe 'ironic::neutron' do
is_expected.to contain_ironic_config('neutron/password').with_value('<SERVICE DEFAULT>').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('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('neutron/endpoint_override').with_value('<SERVICE DEFAULT>')
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

View File

@ -41,6 +41,7 @@ describe 'ironic::swift' do
is_expected.to contain_ironic_config('swift/password').with_value('<SERVICE DEFAULT>').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('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('swift/endpoint_override').with_value('<SERVICE DEFAULT>')
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