Support more [networking] parameters
This change introduces the new octavia::networking class to manage parameters in the [networking] section. Change-Id: Ic75b471a4853b5176804ff6163c24285ce2703ba
This commit is contained in:
@@ -115,10 +115,6 @@
|
||||
# (optional) Retry threshold for waiting for a build slot for an amphorae.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*port_detach_timeout*]
|
||||
# (optional) Seconds to wait for a port to detach from an amphora.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*admin_log_targets*]
|
||||
# (optional) The list of syslog endpoints, host:port comma separated list,
|
||||
# to receive administrative log messages.
|
||||
@@ -178,6 +174,12 @@
|
||||
# (optional) Number of gratuitous ARP announcements to make on each refresh interval.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*port_detach_timeout*]
|
||||
# (optional) Seconds to wait for a port to detach from an amphora.
|
||||
# Defaults to undef
|
||||
#
|
||||
class octavia::controller (
|
||||
$amp_active_retries = $::os_service_default,
|
||||
$amp_active_wait_sec = $::os_service_default,
|
||||
@@ -204,7 +206,6 @@ class octavia::controller (
|
||||
$connection_logging = $::os_service_default,
|
||||
$build_rate_limit = $::os_service_default,
|
||||
$build_active_retries = $::os_service_default,
|
||||
$port_detach_timeout = $::os_service_default,
|
||||
$admin_log_targets = $::os_service_default,
|
||||
$administrative_log_facility = $::os_service_default,
|
||||
$forward_all_logs = $::os_service_default,
|
||||
@@ -218,11 +219,19 @@ class octavia::controller (
|
||||
$vrrp_success_count = $::os_service_default,
|
||||
$vrrp_garp_refresh_interval = $::os_service_default,
|
||||
$vrrp_garp_refresh_count = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$port_detach_timeout = undef,
|
||||
) inherits octavia::params {
|
||||
|
||||
include octavia::deps
|
||||
include octavia::db
|
||||
|
||||
if $port_detach_timeout != undef {
|
||||
warning('The octavia::controller::port_detach_timeout parameter is deprecated. \
|
||||
Use the octavia::networking class instead')
|
||||
}
|
||||
include octavia::networking
|
||||
|
||||
if ! is_service_default($loadbalancer_topology) and
|
||||
! ($loadbalancer_topology in ['SINGLE', 'ACTIVE_STANDBY']) {
|
||||
fail('load balancer topology must be one of SINGLE or ACTIVE_STANDBY')
|
||||
@@ -259,7 +268,6 @@ class octavia::controller (
|
||||
'haproxy_amphora/connection_logging' : value => $connection_logging;
|
||||
'haproxy_amphora/build_rate_limit' : value => $build_rate_limit;
|
||||
'haproxy_amphora/build_active_retries' : value => $build_active_retries;
|
||||
'networking/port_detach_timeout' : value => $port_detach_timeout;
|
||||
'amphora_agent/admin_log_targets' : value => join(any2array($admin_log_targets), ',');
|
||||
'amphora_agent/administrative_log_facility' : value => $administrative_log_facility;
|
||||
'amphora_agent/forward_all_logs' : value => $forward_all_logs;
|
||||
|
86
manifests/networking.pp
Normal file
86
manifests/networking.pp
Normal file
@@ -0,0 +1,86 @@
|
||||
# == Class: octavia::networking
|
||||
#
|
||||
# Setup and configure octavia.conf networking section.
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*max_retries*]
|
||||
# (Optional) The maximum attempts to retry an acction with the networking
|
||||
# service.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*retry_interval*]
|
||||
# (Optional) Seocnds to wait before retrying an action with the networking
|
||||
# service.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*retry_backoff*]
|
||||
# (Optional) The seconds to backoff retry attempts.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*retry_max*]
|
||||
# (Optional) The maximum interval in seconds between retry attempts.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*port_detach_timeout*]
|
||||
# (Optional) Seconds to wait for a port to detach from an amphora.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*allow_vip_network_id*]
|
||||
# (Optional) Can users supply a network_id for their VIP?
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*allow_vip_subnet_id*]
|
||||
# (Optional) Can users supply a subnet_id for their VIP?
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*allow_vip_port_id*]
|
||||
# (Optional) Can users supply a port_id for their VIP?
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*valid_vip_networks*]
|
||||
# (Optional) List of network_ids that are valid for VIP creation.
|
||||
# Defaoutls to $::os_service_default
|
||||
#
|
||||
# [*reserved_ips*]
|
||||
# (Optional) List of IP addresses reserved from being used for member
|
||||
# addresses.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*allow_invisible_resource_usage*]
|
||||
# (Optional) When True, users can use netwokr resources they cannot normally
|
||||
# see as VIP or member subnets.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class octavia::networking (
|
||||
$max_retries = $::os_service_default,
|
||||
$retry_interval = $::os_service_default,
|
||||
$retry_backoff = $::os_service_default,
|
||||
$retry_max = $::os_service_default,
|
||||
$port_detach_timeout = $::os_service_default,
|
||||
$allow_vip_network_id = $::os_service_default,
|
||||
$allow_vip_subnet_id = $::os_service_default,
|
||||
$allow_vip_port_id = $::os_service_default,
|
||||
$valid_vip_networks = $::os_service_default,
|
||||
$reserved_ips = $::os_service_default,
|
||||
$allow_invisible_resource_usage = $::os_service_default,
|
||||
) {
|
||||
|
||||
include octavia::deps
|
||||
|
||||
$port_detach_timeout_real = pick($::octavia::controller::port_detach_timeout, $port_detach_timeout)
|
||||
|
||||
octavia_config {
|
||||
'networking/max_retries': value => $max_retries;
|
||||
'networking/retry_interval': value => $retry_interval;
|
||||
'networking/retry_backoff': value => $retry_backoff;
|
||||
'networking/retry_max': value => $retry_max;
|
||||
'networking/port_detach_timeout': value => $port_detach_timeout_real;
|
||||
'networking/allow_vip_network_id': value => $allow_vip_network_id;
|
||||
'networking/allow_vip_subnet_id': value => $allow_vip_subnet_id;
|
||||
'networking/allow_vip_port_id': value => $allow_vip_port_id;
|
||||
'networking/valid_vip_networks': value => join(any2array($valid_vip_networks), ',');
|
||||
'networking/reserved_ips': value => join(any2array($reserved_ips), ',');
|
||||
'networking/allow_invisible_resource_usage': value => $allow_invisible_resource_usage;
|
||||
}
|
||||
}
|
10
releasenotes/notes/networking-d136ed112f3cdfe8.yaml
Normal file
10
releasenotes/notes/networking-d136ed112f3cdfe8.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``octavia::networking`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``octavia::controller::port_detach_timeout`` parameter has been
|
||||
deprecated in favor of the new ``octavia::networking::port_detach_timeout``
|
||||
parameter.
|
80
spec/classes/octavia_networking_spec.rb
Normal file
80
spec/classes/octavia_networking_spec.rb
Normal file
@@ -0,0 +1,80 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'octavia::networking' do
|
||||
shared_examples 'octavia::networking' do
|
||||
context 'with default parameters' do
|
||||
it {
|
||||
should contain_octavia_config('networking/max_retries').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/retry_interval').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/retry_backoff').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/retry_max').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/port_detach_timeout').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/allow_vip_network_id').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/allow_vip_subnet_id').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/allow_vip_port_id').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/valid_vip_networks').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/reserved_ips').with_value('<SERVICE DEFAULT>')
|
||||
should contain_octavia_config('networking/allow_invisible_resource_usage').with_value('<SERVICE DEFAULT>')
|
||||
}
|
||||
end
|
||||
|
||||
context 'with parameters set' do
|
||||
let :params do
|
||||
{
|
||||
:max_retries => 15,
|
||||
:retry_interval => 1,
|
||||
:retry_backoff => 2,
|
||||
:retry_max => 10,
|
||||
:port_detach_timeout => 300,
|
||||
:allow_vip_network_id => true,
|
||||
:allow_vip_subnet_id => true,
|
||||
:allow_vip_port_id => true,
|
||||
:valid_vip_networks => 'net1,net2',
|
||||
:reserved_ips => '169.254.169.254',
|
||||
:allow_invisible_resource_usage => false
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_octavia_config('networking/max_retries').with_value(15)
|
||||
should contain_octavia_config('networking/retry_interval').with_value(1)
|
||||
should contain_octavia_config('networking/retry_backoff').with_value(2)
|
||||
should contain_octavia_config('networking/retry_max').with_value(10)
|
||||
should contain_octavia_config('networking/port_detach_timeout').with_value(300)
|
||||
should contain_octavia_config('networking/allow_vip_network_id').with_value(true)
|
||||
should contain_octavia_config('networking/allow_vip_subnet_id').with_value(true)
|
||||
should contain_octavia_config('networking/allow_vip_port_id').with_value(true)
|
||||
should contain_octavia_config('networking/valid_vip_networks').with_value('net1,net2')
|
||||
should contain_octavia_config('networking/reserved_ips').with_value('169.254.169.254')
|
||||
should contain_octavia_config('networking/allow_invisible_resource_usage').with_value(false)
|
||||
}
|
||||
end
|
||||
|
||||
context 'with array values' do
|
||||
let :params do
|
||||
{
|
||||
:valid_vip_networks => ['net1', 'net2'],
|
||||
:reserved_ips => ['169.254.169.254', '192.168.0.1'],
|
||||
}
|
||||
end
|
||||
|
||||
it {
|
||||
should contain_octavia_config('networking/valid_vip_networks').with_value('net1,net2')
|
||||
should contain_octavia_config('networking/reserved_ips').with_value('169.254.169.254,192.168.0.1')
|
||||
}
|
||||
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::networking'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user