Add support for oslo.limit library parameters

This change introduces the new oslo::limit resource type, to manage
parameters of the oslo.limit library[1]. This library is used to
implement the unified quota feature, and is used by Glance at the time
of writing.
[1] https://opendev.org/openstack/oslo.limit
Change-Id: Ic07fe61a530982ae6ae972f52775f5aec51b3134
This commit is contained in:
Takashi Kajinami
2021年10月07日 10:45:35 +09:00
parent 1d71aa2797
commit f1ed9f4023

81
manifests/limit.pp Normal file
View File

@@ -0,0 +1,81 @@
#==Define:oslo::limit
#
#Configureoslo_limitoptions
#
#===Parameters:
#
#[*endpoint_id*]
#(Required)Theservice'sendpointidwhichisregisteredinKeystone.
#
#[*username*]
#(Required)Thenameoftheserviceuser
#
#[*password*]
#(Required)Passwordtocreatefortheserviceuser
#
#[*auth_url*]
#(Required)TheURLtouseforauthentication.
#
#[*project_name*]
#(Required)Serviceprojectname
#
#[*user_domain_name*]
#(Optional)Nameofdomainfor$username
#Defaultsto'Default'.
#
#[*project_domain_name*]
#(Optional)Nameofdomainfor$project_name
#Defaultsto'Default'.
#
#[*auth_type*]
#(Optional)Authenticationtypetoload
#Defaultsto'password'.
#
#[*service_type*]
#(Optional)Thenameortypeoftheserviceasitappearsintheservice
#catalog.Thisisusedtovalidatetokensthathaverestrictedaccessrules.
#Defaultsto$::os_service_default.
#
#[*valid_interfaces*]
#(Optional)Listofinterfaces,inorderofpreference,forendpointURL.
#Defaultsto$::os_service_default.
#
#[*region_name*]
#(Optional)Theregioninwhichtheidentityservercanbefound.
#Defaultsto$::os_service_default.
#
#[*endpoint_override*]
#(Optional)AlwaysusethisendpointURLforrequestsforthisclient.
#Defualtsto$::os_service_default.
#
defineoslo::limit(
$endpoint_id,
$username,
$password,
$auth_url,
$project_name,
$user_domain_name='Default',
$project_domain_name='Default',
$auth_type='password',
$service_type=$::os_service_default,
$valid_interfaces=$::os_service_default,
$region_name=$::os_service_default,
$endpoint_override=$::os_service_default,
){
$limit_options = {
'oslo_limit/endpoint_id' => { value => $endpoint_id },
'oslo_limit/username'=>{ value => $username },
'oslo_limit/password'=>{ value => $password },
'oslo_limit/auth_url'=>{ value => $auth_url },
'oslo_limit/project_name'=>{ value => $project_name },
'oslo_limit/user_domain_name'=>{ value => $user_domain_name },
'oslo_limit/project_domain_name'=>{ value => $project_domain_name },
'oslo_limit/auth_type'=>{ value => $auth_type },
'oslo_limit/service_type'=>{ value => $service_type },
'oslo_limit/valid_interfaces'=>{ value => join(any2array($valid_interfaces), ',') },
'oslo_limit/region_name'=>{ value => $region_name },
'oslo_limit/endpoint_override'=>{ value => $endpoint_override },
}
create_resources($name,$limit_options)
}

View File

@@ -0,0 +1,5 @@
---
features:
- |
The new ``oslo::limit`` resource type has been added. This manages
parameters of the ``oslo.limit`` library.

View File

@@ -0,0 +1,79 @@
require 'spec_helper'
describe 'oslo::limit' do
let (:title) { 'keystone_config' }
shared_examples 'oslo::limit' do
let :required_params do
{
:endpoint_id => '770f924a-e483-4b43-a6f3-73acc91f4757',
:username => 'keystone',
:password => 'keystone_password',
:auth_url => 'http://127.0.0.1:5000/v3',
:project_name => 'services',
}
end
context 'with default parameters' do
let :params do
required_params
end
it 'configures the required params' do
is_expected.to contain_keystone_config('oslo_limit/endpoint_id').with_value('770f924a-e483-4b43-a6f3-73acc91f4757')
is_expected.to contain_keystone_config('oslo_limit/username').with_value('keystone')
is_expected.to contain_keystone_config('oslo_limit/password').with_value('keystone_password')
is_expected.to contain_keystone_config('oslo_limit/auth_url').with_value('http://127.0.0.1:5000/v3')
is_expected.to contain_keystone_config('oslo_limit/project_name').with_value('services')
end
it 'configures the default params' do
is_expected.to contain_keystone_config('oslo_limit/user_domain_name').with_value('Default')
is_expected.to contain_keystone_config('oslo_limit/project_domain_name').with_value('Default')
is_expected.to contain_keystone_config('oslo_limit/auth_type').with_value('password')
is_expected.to contain_keystone_config('oslo_limit/service_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_limit/valid_interfaces').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_limit/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_limit/endpoint_override').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
required_params.merge!({
:user_domain_name => 'UserDomain',
:project_domain_name => 'ProjectDomain',
:auth_type => 'v3password',
:service_type => 'identity',
:valid_interfaces => ['admin', 'internal'],
:region_name => 'regionOne',
:endpoint_override => 'http://localhost:5000',
})
end
it 'configures the overridden values' do
is_expected.to contain_keystone_config('oslo_limit/user_domain_name').with_value('UserDomain')
is_expected.to contain_keystone_config('oslo_limit/project_domain_name').with_value('ProjectDomain')
is_expected.to contain_keystone_config('oslo_limit/auth_type').with_value('v3password')
is_expected.to contain_keystone_config('oslo_limit/service_type').with_value('identity')
is_expected.to contain_keystone_config('oslo_limit/valid_interfaces').with_value('admin,internal')
is_expected.to contain_keystone_config('oslo_limit/region_name').with_value('regionOne')
is_expected.to contain_keystone_config('oslo_limit/endpoint_override').with_value('http://localhost:5000')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
include_examples 'oslo::limit'
end
end
end
Reference in New Issue
openstack/puppet-oslo
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.