From 3dc8602da67c4bed1d85cc8563773daf1b514086 Mon Sep 17 00:00:00 2001 From: Brent Eagles Date: Tue, 16 Jan 2018 16:32:09 -0330 Subject: [PATCH] Add amp_project_name to configure flavor access list Adds support for adding the project being used by octavia to create amphora to the amphora flavor's access list. Change-Id: Iba14098d571f26e15c587b82271f00fd7cdc65d5 --- manifests/worker.pp | 14 ++++++++++++-- ...-amphora-project-name-0afeebd83e114328.yaml | 5 +++++ spec/classes/octavia_worker_spec.rb | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-amphora-project-name-0afeebd83e114328.yaml diff --git a/manifests/worker.pp b/manifests/worker.pp index 66d4c98b..904380c6 100644 --- a/manifests/worker.pp +++ b/manifests/worker.pp @@ -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', diff --git a/releasenotes/notes/add-amphora-project-name-0afeebd83e114328.yaml b/releasenotes/notes/add-amphora-project-name-0afeebd83e114328.yaml new file mode 100644 index 00000000..4023c6c8 --- /dev/null +++ b/releasenotes/notes/add-amphora-project-name-0afeebd83e114328.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds 'amp_project_name' to configure project access to the nova flavor for creating amphorae. + diff --git a/spec/classes/octavia_worker_spec.rb b/spec/classes/octavia_worker_spec.rb index bb770845..e6371f5e 100644 --- a/spec/classes/octavia_worker_spec.rb +++ b/spec/classes/octavia_worker_spec.rb @@ -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