Deprecate keystone::endpoint::version

With the move to Keystone v3 API, let's deprecate version parameter and
set it to undef by default, so it will deploy Keystone versionless
endpoints.

Keep the capacity to set it to 'unset' so v2.0 will still be created, so
our users have a path of migration.

Though this patch changes the default value so from now, endpoints will
be created by default without version. If this patch breaks you, set
version to 'unset' and think about a migration to Keystone v3.

Change-Id: Ic2f741589bfbd687417e086379fc2fe60eba2024
This commit is contained in:
Emilien Macchi 2017-02-24 14:58:25 -05:00
parent cc50dfbe77
commit 283ef7fa71
3 changed files with 22 additions and 19 deletions

View File

@ -38,7 +38,7 @@
#
# [*version*]
# (optional) API version for endpoint.
# Defaults to 'v2.0'. Valid values are 'v2.0', 'v3', or the empty string ''.
# Defaults to ''. Valid values are 'v2.0', 'v3', or the empty string ''.
# If the version is set to the empty string (''), then it won't be
# used. This is the expected behaviour since Keystone V3 handles API versions
# from the context.
@ -59,17 +59,13 @@ class keystone::endpoint (
$user_domain = undef,
$project_domain = undef,
$default_domain = undef,
$version = 'unset', # defaults to 'v2.0' if unset by user
$version = '',
) {
include ::keystone::deps
if $version == 'unset' {
# $version will be set to empty '' once tempest & all openstack clients
# actually support versionless endpoints.
# See ongoing work in Tempest:
# https://review.openstack.org/#/q/status:open+project:openstack/tempest-lib+branch:master+topic:bug/1530181
# Until that, we need to set a version by default.
warning('keystone::endpoint::version parameter is deprecated and will be removed in a future release.')
$_version = 'v2.0'
} else {
$_version = $version

View File

@ -0,0 +1,9 @@
---
deprecations:
- keystone::endpoint::version is not default to undef which means
Keystone endpoints will be versionless by default, so it enables
services to reach Keystone v3 with is the current stable version.
Therefore, we don't need the version parameter, so we deprecate it
in this cycle and will remove it later.
If the user used to set 'unset' to $version, it will keep v2.0 endpoint
but a migration to undef is recommended.

View File

@ -10,9 +10,9 @@ describe 'keystone::endpoint' do
describe 'with default parameters' do
it { is_expected.to contain_keystone_endpoint('RegionOne/keystone::identity').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:5000/v2.0',
:admin_url => 'http://127.0.0.1:35357/v2.0',
:internal_url => 'http://127.0.0.1:5000/v2.0',
:public_url => 'http://127.0.0.1:5000',
:admin_url => 'http://127.0.0.1:35357',
:internal_url => 'http://127.0.0.1:5000',
:region => 'RegionOne'
)}
end
@ -37,18 +37,16 @@ describe 'keystone::endpoint' do
)}
end
describe 'without a version' do
# We need to test empty value '' to override the default value, using undef
# cannot un-set classes parameters.
describe 'with unset version to test backward compatibility' do
let :params do
{ :version => '' }
{ :version => 'unset' }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/keystone::identity').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:5000',
:admin_url => 'http://127.0.0.1:35357',
:internal_url => 'http://127.0.0.1:5000'
:public_url => 'http://127.0.0.1:5000/v2.0',
:admin_url => 'http://127.0.0.1:35357/v2.0',
:internal_url => 'http://127.0.0.1:5000/v2.0'
)}
end
@ -61,8 +59,8 @@ describe 'keystone::endpoint' do
it 'internal_url should default to public_url' do
is_expected.to contain_keystone_endpoint('RegionOne/keystone::identity').with(
:ensure => 'present',
:public_url => 'https://identity.some.tld/the/main/endpoint/v2.0',
:internal_url => 'https://identity.some.tld/the/main/endpoint/v2.0'
:public_url => 'https://identity.some.tld/the/main/endpoint',
:internal_url => 'https://identity.some.tld/the/main/endpoint'
)
end
end