Add support for [octavia_client] parameters

Change-Id: Id34a8b2a34f17c32a6d0f11537e0c6e1bac5ee88
This commit is contained in:
Takashi Kajinami 2021-11-15 14:22:38 +09:00
parent 1faacc8c68
commit 27b28f3826
5 changed files with 116 additions and 0 deletions

View File

@ -47,4 +47,5 @@ class magnum::clients (
include magnum::clients::magnum
include magnum::clients::neutron
include magnum::clients::nova
include magnum::clients::octavia
}

View File

@ -0,0 +1,53 @@
# == Class: magnum::clients::octavia
#
# Manages octavia clients configuration in magnum server
#
# === Parameters:
#
# [*region_name*]
# (optional) Region in Identity service catalog to use for communication
# with the OpenStack service.
# Defaults to RegionOne
#
# [*endpoint_type*]
# (optional) Type of endpoint in Identity service catalog to use for
# communication with the OpenStack service.
# Defaults to publicURL
#
# [*ca_file*]
# (optional) CA cert file to use in SSL connections.
# Defaults to $::os_service_default
#
# [*cert_file*]
# (optional) PEM-formatted certificate chain file.
# Defaults to $::os_service_default
#
# [*key_file*]
# (optional) PEM-formatted file that contains the private key.
# Defaults to $::os_service_default
#
# [*insecure*]
# (optional) If set, then the server's certificate will not be verified.
# Defaults to false
#
class magnum::clients::octavia(
$region_name = $magnum::clients::region_name,
$endpoint_type = $magnum::clients::endpoint_type,
$ca_file = $magnum::clients::ca_file,
$cert_file = $magnum::clients::cert_file,
$key_file = $magnum::clients::key_file,
$insecure = $magnum::clients::insecure,
){
include magnum::deps
include magnum::params
magnum_config {
'octavia_client/region_name': value => $region_name;
'octavia_client/endpoint_type': value => $endpoint_type;
'octavia_client/ca_file': value => $ca_file;
'octavia_client/cert_file': value => $cert_file;
'octavia_client/key_file': value => $key_file;
'octavia_client/insecure': value => $insecure;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``magnum::clients::octavia`` class has been added.

View File

@ -0,0 +1,57 @@
require 'spec_helper'
describe 'magnum::clients::octavia' do
shared_examples 'magnum::clients::octavia' do
context 'with default parameters' do
let :params do
{ :region_name => 'RegionOne',
:endpoint_type => 'publicURL',
:ca_file => '<SERVICE DEFAULT>',
:cert_file => '<SERVICE DEFAULT>',
:key_file => '<SERVICE DEFAULT>',
:insecure => false,
}
end
it { is_expected.to contain_magnum_config('octavia_client/region_name').with_value('RegionOne') }
it { is_expected.to contain_magnum_config('octavia_client/endpoint_type').with_value('publicURL') }
it { is_expected.to contain_magnum_config('octavia_client/ca_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('octavia_client/cert_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('octavia_client/key_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_magnum_config('octavia_client/insecure').with_value(false) }
end
context 'with specific parameters' do
let :params do
{ :region_name => 'RegionTwo',
:endpoint_type => 'adminURL',
:ca_file => '/etc/magnum/certs/ca.pem',
:cert_file => '/etc/magnum/certs/cert.pem',
:key_file => '/etc/magnum/certs/pri.key',
:insecure => true,
}
end
it { is_expected.to contain_magnum_config('octavia_client/region_name').with_value('RegionTwo') }
it { is_expected.to contain_magnum_config('octavia_client/endpoint_type').with_value('adminURL') }
it { is_expected.to contain_magnum_config('octavia_client/ca_file').with_value('/etc/magnum/certs/ca.pem') }
it { is_expected.to contain_magnum_config('octavia_client/cert_file').with_value('/etc/magnum/certs/cert.pem') }
it { is_expected.to contain_magnum_config('octavia_client/key_file').with_value('/etc/magnum/certs/pri.key') }
it { is_expected.to contain_magnum_config('octavia_client/insecure').with_value(true) }
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_configures 'magnum::clients::octavia'
end
end
end

View File

@ -14,6 +14,7 @@ describe 'magnum::clients' do
is_expected.to contain_class('magnum::clients::nova')
is_expected.to contain_class('magnum::clients::magnum')
is_expected.to contain_class('magnum::clients::neutron')
is_expected.to contain_class('magnum::clients::octavia')
end
end