Add support for volume based amphora

This change introduces support for configurations to use volume based
amphora instances.

Change-Id: I9f9c53bfe95364a89deed8d342c45310f52a11b4
This commit is contained in:
Takashi Kajinami 2021-03-12 22:18:58 +09:00
parent c0a49179c6
commit ebf7fdc31c
5 changed files with 154 additions and 0 deletions

74
manifests/cinder.pp Normal file
View File

@ -0,0 +1,74 @@
# == Class: octavia::cinder
#
# Setup and configure octavia.conf cinder section.
#
# === Parameters:
#
# [*service_name*]
# (Optional) The name of the cinder service in the keystone catalog.
# Defaults to $::os_service_default
#
# [*endpoint*]
# (Optional) Custom cinder endpoint if override is necessary.
# Defaults to $::os_service_default
#
# [*region_name*]
# (Optional) Region in catalog to use for cinder.
# Defaults to $::os_service_default
#
# [*endpoint_type*]
# (Optional) Endpoint type in catalog to use for cinder.
# Defaults to $::os_service_default
#
# [*availability_zone*]
# (Optional) Availability zone to use for creating volume.
# Defaults to $::os_service_default
#
# [*volume_size*]
# (Optional) Size of volume, in GB, for Amphora instance
# Defaults to $::os_service_default
#
# [*volume_type*]
# (Optional) Type of volume for Amphorae voume root disk
# Defaults to $::os_service_default
#
# [*volume_create_retry_interval*]
# (Optional) Interval time to wait volume is created in available state
# Defaults to $::os_service_default
#
# [*volume_create_timeout*]
# (Optional) Timeout to wait volume is created in available
# Defaults to $::os_service_default
#
# [*volume_create_max_retries*]
# (Optional) Maximum number of retries to create volume
# Defaults to $::os_service_default
#
class octavia::cinder (
$service_name = $::os_service_default,
$endpoint = $::os_service_default,
$region_name = $::os_service_default,
$endpoint_type = $::os_service_default,
$availability_zone = $::os_service_default,
$volume_size = $::os_service_default,
$volume_type = $::os_service_default,
$volume_create_retry_interval = $::os_service_default,
$volume_create_timeout = $::os_service_default,
$volume_create_max_retries = $::os_service_default,
) {
include octavia::deps
octavia_config {
'cinder/service_name': value => $service_name;
'cinder/endpoint': value => $endpoint;
'cinder/region_name': value => $region_name;
'cinder/endpoint_type': value => $endpoint_type;
'cinder/availability_zone': value => $availability_zone;
'cinder/volume_size': value => $volume_size;
'cinder/volume_type': value => $volume_type;
'cinder/volume_create_retry_interval': value => $volume_create_retry_interval;
'cinder/volume_create_timeout': value => $volume_create_timeout;
'cinder/volume_create_max_retries': value => $volume_create_max_retries;
}
}

View File

@ -53,6 +53,10 @@
# for amphorae.
# Defaults to $::os_service_default
#
# [*volume_driver*]
# (optional) Name of volume driver for managing amphora volumes
# Defaults to $::os_service_default
#
# [*amp_ssh_key_name*]
# (optional) Name of Openstack SSH keypair for communicating with amphora
# Defaults to 'octavia-ssh-key'
@ -177,6 +181,7 @@ class octavia::controller (
$amphora_driver = $::os_service_default,
$compute_driver = $::os_service_default,
$network_driver = $::os_service_default,
$volume_driver = $::os_service_default,
$enable_ssh_access = true,
$amp_ssh_key_name = 'octavia-ssh-key',
$timeout_client_data = $::os_service_default,
@ -231,6 +236,7 @@ class octavia::controller (
'controller_worker/amphora_driver' : value => $amphora_driver;
'controller_worker/compute_driver' : value => $compute_driver;
'controller_worker/network_driver' : value => $network_driver;
'controller_worker/volume_driver' : value => $volume_driver;
'haproxy_amphora/timeout_client_data' : value => $timeout_client_data;
'haproxy_amphora/timeout_member_connect' : value => $timeout_member_connect;
'haproxy_amphora/timeout_member_data' : value => $timeout_member_data;

View File

@ -0,0 +1,8 @@
---
features:
- |
The new ``octavia::cinder`` class has been added. This class manages
parameters of the ``[cinder]`` section.
- |
The new ``octavia::controller::volume_type`` parameter has been added.

View File

@ -0,0 +1,63 @@
require 'spec_helper'
describe 'octavia::cinder' do
shared_examples 'octavia::cinder' do
context 'with default parameters' do
it {
should contain_octavia_config('cinder/service_name').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/endpoint').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/region_name').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/availability_zone').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/volume_size').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/volume_type').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/volume_create_retry_interval').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/volume_create_timeout').with_value('<SERVICE DEFAULT>')
should contain_octavia_config('cinder/volume_create_max_retries').with_value('<SERVICE DEFAULT>')
}
end
context 'with specified parameters' do
let :params do
{
:service_name => 'compute',
:endpoint => 'http://127.0.0.1:8776',
:region_name => 'RegionOne',
:endpoint_type => 'internalURL',
:availability_zone => 'nova',
:volume_size => 16,
:volume_type => 'default',
:volume_create_retry_interval => 5,
:volume_create_timeout => 300,
:volume_create_max_retries => 5,
}
end
it {
should contain_octavia_config('cinder/service_name').with_value('compute')
should contain_octavia_config('cinder/endpoint').with_value('http://127.0.0.1:8776')
should contain_octavia_config('cinder/region_name').with_value('RegionOne')
should contain_octavia_config('cinder/endpoint_type').with_value('internalURL')
should contain_octavia_config('cinder/availability_zone').with_value('nova')
should contain_octavia_config('cinder/volume_size').with_value(16)
should contain_octavia_config('cinder/volume_type').with_value('default')
should contain_octavia_config('cinder/volume_create_retry_interval').with_value(5)
should contain_octavia_config('cinder/volume_create_timeout').with_value(300)
should contain_octavia_config('cinder/volume_create_max_retries').with_value(5)
}
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::cinder'
end
end
end

View File

@ -24,6 +24,7 @@ describe 'octavia::controller' do
:amphora_driver => 'sample_amphora_driver',
:compute_driver => 'sample_compute_driver',
:network_driver => 'sample_network_driver',
:volume_driver => 'sample_volume_driver',
:amp_ssh_key_name => 'custom-amphora-key',
:timeout_client_data => 60,
:timeout_member_connect => 5,
@ -62,6 +63,7 @@ describe 'octavia::controller' do
is_expected.to contain_octavia_config('controller_worker/amphora_driver').with_value('sample_amphora_driver')
is_expected.to contain_octavia_config('controller_worker/compute_driver').with_value('sample_compute_driver')
is_expected.to contain_octavia_config('controller_worker/network_driver').with_value('sample_network_driver')
is_expected.to contain_octavia_config('controller_worker/volume_driver').with_value('sample_volume_driver')
is_expected.to contain_octavia_config('controller_worker/amp_ssh_key_name').with_value('custom-amphora-key')
is_expected.to contain_octavia_config('haproxy_amphora/timeout_client_data').with_value(60)
is_expected.to contain_octavia_config('haproxy_amphora/timeout_member_connect').with_value(5)
@ -100,6 +102,7 @@ describe 'octavia::controller' do
is_expected.to contain_octavia_config('controller_worker/amphora_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('controller_worker/compute_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('controller_worker/network_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('controller_worker/volume_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('controller_worker/amp_ssh_key_name').with_value('octavia-ssh-key')
is_expected.to contain_octavia_config('haproxy_amphora/timeout_client_data').with_value('<SERVICE DEFAULT>')
is_expected.to contain_octavia_config('haproxy_amphora/timeout_member_connect').with_value('<SERVICE DEFAULT>')