Add octavia::nova to configure nova section
Adds new class octavia::nova that can be used to configure the nova section in octavia.conf Change-Id: I7d271c0184750aa90be59a25944c29fec3c3afd2
This commit is contained in:
parent
54c9e53a27
commit
6864cd083d
manifests
releasenotes/notes
spec/classes
57
manifests/nova.pp
Normal file
57
manifests/nova.pp
Normal file
@ -0,0 +1,57 @@
|
||||
# == Class: octavia::nova
|
||||
#
|
||||
# Setup and configure octavia.conf nova section.
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*service_name*]
|
||||
# (Optional) The name of the nova service in the keystone catalog.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint*]
|
||||
# (Optional) Custom nova endpoint if override is necessary.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region in catalog to use for nova.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Endpoint type in catalog to use for nova.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*availability_zone*]
|
||||
# (Optional) Availability zone to use for creating Amphorae.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*enable_anti_affinity*]
|
||||
# (Optional) Enable anti-affinity in nova.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*anti_affinity_policy*]
|
||||
# (Optional) Set the anti-affinity policy to what is suitable.
|
||||
# Nova supports: anti-affinity and soft-anti-affinity.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class octavia::nova (
|
||||
$service_name = $::os_service_default,
|
||||
$endpoint = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$availability_zone = $::os_service_default,
|
||||
$enable_anti_affinity = $::os_service_default,
|
||||
$anti_affinity_policy = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::octavia::deps
|
||||
|
||||
octavia_config {
|
||||
'nova/service_name': value => $service_name;
|
||||
'nova/endpoint': value => $endpoint;
|
||||
'nova/region_name': value => $region_name;
|
||||
'nova/endpoint_type': value => $endpoint_type;
|
||||
'nova/availability_zone': value => $availability_zone;
|
||||
'nova/enable_anti_affinity': value => $enable_anti_affinity;
|
||||
'nova/anti_affinity_policy': value => $anti_affinity_policy;
|
||||
}
|
||||
}
|
5
releasenotes/notes/octavia-nova-0205d7406d58e871.yaml
Normal file
5
releasenotes/notes/octavia-nova-0205d7406d58e871.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added new octavia::nova class that can be used to configure the nova section
|
||||
in octavia.conf
|
54
spec/classes/octavia_nova_spec.rb
Normal file
54
spec/classes/octavia_nova_spec.rb
Normal file
@ -0,0 +1,54 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'octavia::nova' do
|
||||
shared_examples 'octavia::nova' do
|
||||
context 'with default parameters' do
|
||||
it {
|
||||
should contain_octavia_config('nova/service_name').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/endpoint').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/region_name').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/availability_zone').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/enable_anti_affinity').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('nova/anti_affinity_policy').with_value('<SERVICE DEFAULT>')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with specified parameters' do
|
||||
let :params do
|
||||
{
|
||||
:service_name => 'compute',
|
||||
:endpoint => 'http://127.0.0.1:8774',
|
||||
:region_name => 'RegionOne',
|
||||
:endpoint_type => 'internalURL',
|
||||
:availability_zone => 'nova',
|
||||
:enable_anti_affinity => true,
|
||||
:anti_affinity_policy => 'anti-affinity',
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_octavia_config('nova/service_name').with_value('compute')
|
||||
should contain_octavia_config('nova/endpoint').with_value('http://127.0.0.1:8774')
|
||||
should contain_octavia_config('nova/region_name').with_value('RegionOne')
|
||||
should contain_octavia_config('nova/endpoint_type').with_value('internalURL')
|
||||
should contain_octavia_config('nova/availability_zone').with_value('nova')
|
||||
should contain_octavia_config('nova/enable_anti_affinity').with_value(true)
|
||||
should contain_octavia_config('nova/anti_affinity_policy').with_value('anti-affinity')
|
||||
}
|
||||
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 'octavia::nova'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user