Adding service_auth configuration

Adds support for the basic set of 'service_auth' section parameters
for Octavia.

Change-Id: Ifcd38386db386ee6d61aa7f262b1e14ac6516eb7
This commit is contained in:
Brent Eagles 2017-12-05 16:05:31 -03:30
parent f6c2841c45
commit 9faccf9cac
3 changed files with 103 additions and 0 deletions

50
manifests/service_auth.pp Normal file
View File

@ -0,0 +1,50 @@
#
# Configures credentials for service to service communication.
#
# === Parameters:
#
# [*auth_url*]
# (optional) Keystone Authentication URL
# Defaults to $::os_service_default
#
# [*username*]
# (optional) User for accessing neutron and other services.
# Defaults to $::os_service_default
#
# [*project_name*]
# (optional) Tenant for accessing neutron and other services
# Defaults to $::os_service_default
#
# [*password*]
# (optional) Password for user
# Defaults to $::os_service_default
#
# [*user_domain_name*]
# (optional) keystone user domain
# Defaults to $::os_service_default
#
# [*project_domain_name*]
# (optional) keystone project domain
# Defaults to $::os_service_default
#
class octavia::service_auth (
$auth_url = $::os_service_default,
$username = $::os_service_default,
$project_name = $::os_service_default,
$password = $::os_service_default,
$user_domain_name = $::os_service_default,
$project_domain_name = $::os_service_default,
) {
include ::octavia::deps
octavia_config {
'service_auth/auth_url' : value => $auth_url;
'service_auth/username' : value => $username;
'service_auth/project_name' : value => $project_name;
'service_auth/password' : value => $password;
'service_auth/user_domain_name' : value => $user_domain_name;
'service_auth/project_domain_name' : value => $project_domain_name;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
Add support for configuring 'service_auth' section parameters in octavia.

View File

@ -0,0 +1,49 @@
require 'spec_helper'
describe 'octavia::service_auth' do
shared_examples_for 'service-auth' do
context 'with default params' do
it 'configures default auth' do
is_expected.to contain_octavia_config('service_auth/auth_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('service_auth/username').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('service_auth/project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('service_auth/password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('service_auth/user_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('service_auth/project_domain_name').with_value('<SERVICE DEFAULT>')
end
end
context 'when credentials are configured' do
let :params do
{ :auth_url => 'http://199.199.199.199:64371',
:username => 'some_user',
:project_name => 'some_project_name',
:password => 'secure123',
:user_domain_name => 'my_domain_name',
:project_domain_name => 'our_domain_name'
}
end
it 'configures credentials' do
is_expected.to contain_octavia_config('service_auth/auth_url').with_value('http://199.199.199.199:64371')
is_expected.to contain_octavia_config('service_auth/username').with_value('some_user')
is_expected.to contain_octavia_config('service_auth/project_name').with_value('some_project_name')
is_expected.to contain_octavia_config('service_auth/password').with_value('secure123')
is_expected.to contain_octavia_config('service_auth/user_domain_name').with_value('my_domain_name')
is_expected.to contain_octavia_config('service_auth/project_domain_name').with_value('our_domain_name')
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
it_behaves_like 'service-auth'
end
end
end