Merge "Add amp_project_name to configure flavor access list"

This commit is contained in:
Zuul 2018-01-19 23:14:39 +00:00 committed by Gerrit Code Review
commit a8a2fe98c3
3 changed files with 35 additions and 2 deletions

View File

@ -80,6 +80,10 @@
# (optional) Whether or not create OpenStack keypair for communicating with amphora
# Defaults to false
#
# [*amp_project_name*]
# (optional) Set the project to be used for creating load balancer instances.
# Defaults to undef
#
class octavia::worker (
$manage_service = true,
$enabled = true,
@ -97,7 +101,8 @@ class octavia::worker (
$amp_ssh_key_name = 'octavia-ssh-key',
$enable_ssh_access = true,
$key_path = '/etc/octavia/.ssh/octavia_ssh_key',
$manage_keygen = false
$manage_keygen = false,
$amp_project_name = undef
) inherits octavia::params {
include ::octavia::deps
@ -116,7 +121,12 @@ class octavia::worker (
}
} else {
if $manage_nova_flavor {
$octavia_flavor = { "octavia_${amp_flavor_id}" => { 'id' => $amp_flavor_id } }
$octavia_flavor = { "octavia_${amp_flavor_id}" =>
{ 'id' => $amp_flavor_id,
'project' => $amp_project_name
}
}
$octavia_flavor_defaults = {
'ensure' => 'present',
'ram' => '1024',

View File

@ -0,0 +1,5 @@
---
features:
- |
Adds 'amp_project_name' to configure project access to the nova flavor for creating amphorae.

View File

@ -34,6 +34,12 @@ describe 'octavia::worker' do
:loadbalancer_topology => 'SINGLE',
:amp_ssh_key_name => 'custom-amphora-key',
:key_path => '/opt/octavia/ssh/amphora_key',
:amp_project_name => 'loadbalancers',
:nova_flavor_config => {
'ram' => '2048',
'disk' => '3',
'vcpus' => '4'
}
})
end
@ -44,6 +50,18 @@ describe 'octavia::worker' do
it { is_expected.to contain_octavia_config('controller_worker/loadbalancer_topology').with_value('SINGLE') }
it { is_expected.to contain_octavia_config('controller_worker/amp_ssh_key_name').with_value('custom-amphora-key') }
it { is_expected.to contain_octavia_config('haproxy_amphora/key_path').with_value('/opt/octavia/ssh/amphora_key') }
it 'deploys a nova flavor for amphora' do
is_expected.to contain_nova_flavor('octavia_42').with(
:ensure => 'present',
:id => '42',
:ram => '2048',
:disk => '3',
:vcpus => '4',
:is_public => false,
:project => 'loadbalancers',
:tag => ['octavia'],
)
end
end
it 'configures worker parameters' do