Add driver agent configuration

Add support for octavia driver agent configuration options.

Change-Id: Ica6f84256ff2068e9bac210e66a1429ea627256c
This commit is contained in:
Brent Eagles 2019-06-05 18:09:58 +00:00 committed by Takashi Kajinami
parent 17c5182534
commit 88ff210c30
3 changed files with 168 additions and 0 deletions

92
manifests/driver_agent.pp Normal file
View File

@ -0,0 +1,92 @@
# Configures the octavia driver agent
#
# == Parameters
#
# [*status_socket_path*]
# (optional) Path to the driver status unix domain socket file.
# Defaults to $::os_service_default
#
# [*stats_socket_path*]
# (optional) Path to the driver statistics unix domain socket file.
# Defaults to $::os_service_default
#
# [*get_socket_path*]
# (optional) Path to the driver get unix domain socket file.
# Defaults to $::os_service_default
#
# [*status_request_timeout*]
# (optional) Time, in seconds, to wait for a status update request.
# Defaults to $::os_service_default
#
# [*status_max_processes*]
# (optional) Maximum number of concurrent processes to use servicing status
# updates.
# Defaults to $::os_service_default
#
# [*stats_request_timeout*]
# (optional) Time, in seconds, to wait for a statistics update request.
# Defaults to $::os_service_default
#
# [*stats_max_processes*]
# (optional) Maximum number of concurrent processes to use servicing
# statistics updates.
# Defaults to $::os_service_default
#
# [*get_request_timeout*]
# (optional) Time, in seconds, to wait for a get request.
# Defaults to $::os_service_default
#
# [*get_max_processes*]
# (optional) Maximum number of concurrent processes to use servicing get
# requests.
# Defaults to $::os_service_default
#
# [*max_process_warning_percent*]
# (optional) Percentage of max_processes (both status and stats) in use to
# start logging warning messages about an overloaded driver-agent.
# Defaults to $::os_service_default
#
# [*provider_agent_shutdown_timeout*]
# (optional) The time, in seconds, to wait for provider agents to shutdown
# after the exit event has been set.
# Defaults to $::os_service_default
#
# [*enabled_provider_agents*]
# (optional) List of enabled provider agents. The driver-agent will launch
# these agents at startup.
# Defaults to $::os_service_default
#
class octavia::driver_agent (
$status_socket_path = $::os_service_default,
$stats_socket_path = $::os_service_default,
$get_socket_path = $::os_service_default,
$status_request_timeout = $::os_service_default,
$status_max_processes = $::os_service_default,
$stats_request_timeout = $::os_service_default,
$stats_max_processes = $::os_service_default,
$get_request_timeout = $::os_service_default,
$get_max_processes = $::os_service_default,
$max_process_warning_percent = $::os_service_default,
$provider_agent_shutdown_timeout = $::os_service_default,
$enabled_provider_agents = $::os_service_default,
) inherits octavia::params {
include octavia::deps
# Octavia packaging does not currently provide a separate agent service or package.
octavia_config {
'driver_agent/status_socket_path': value => $status_socket_path;
'driver_agent/stats_socket_path': value => $stats_socket_path;
'driver_agent/get_socket_path': value => $get_socket_path;
'driver_agent/status_request_timeout': value => $status_request_timeout;
'driver_agent/status_max_processes': value => $status_max_processes;
'driver_agent/stats_request_timeout': value => $stats_request_timeout;
'driver_agent/stats_max_processes': value => $stats_max_processes;
'driver_agent/get_request_timeout': value => $get_request_timeout;
'driver_agent/get_max_processes': value => $get_max_processes;
'driver_agent/max_process_warning_percent': value => $max_process_warning_percent;
'driver_agent/provider_agent_shutdown_timeout': value => $provider_agent_shutdown_timeout;
'driver_agent/enabled_provider_agents': value => $enabled_provider_agents;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
Added octavia::driver_agent for configuring driver agent properties.

View File

@ -0,0 +1,72 @@
require 'spec_helper'
describe 'octavia::driver_agent' do
let :params do
{
}
end
shared_examples_for 'octavia-driver-agent' do
context 'with default parameters' do
it { is_expected.to contain_octavia_config('driver_agent/status_socket_path').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/stats_socket_path').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/get_socket_path').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/status_request_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/status_max_processes').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/stats_request_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/stats_max_processes').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/get_request_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/get_max_processes').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/max_process_warning_percent').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/provider_agent_shutdown_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('driver_agent/enabled_provider_agents').with_value('<SERVICE DEFAULT>') }
end
context 'with specific parameters' do
before do
params.merge!({
:status_socket_path => '/var/run/octavia/foo.sck',
:stats_socket_path => '/var/run/octavia/bar.sck',
:get_socket_path => '/var/run/octavia/pikachu.sck',
:status_request_timeout => 60,
:status_max_processes => 10,
:stats_request_timeout => 60,
:stats_max_processes => 10,
:get_request_timeout => 60,
:get_max_processes => 10,
:max_process_warning_percent => 0.60,
:provider_agent_shutdown_timeout => 60,
:enabled_provider_agents => ['agent-a', 'agent-b'],
})
end
it { is_expected.to contain_octavia_config('driver_agent/status_socket_path').with_value('/var/run/octavia/foo.sck') }
it { is_expected.to contain_octavia_config('driver_agent/stats_socket_path').with_value('/var/run/octavia/bar.sck') }
it { is_expected.to contain_octavia_config('driver_agent/get_socket_path').with_value('/var/run/octavia/pikachu.sck') }
it { is_expected.to contain_octavia_config('driver_agent/status_request_timeout').with_value(60)}
it { is_expected.to contain_octavia_config('driver_agent/status_max_processes').with_value(10) }
it { is_expected.to contain_octavia_config('driver_agent/stats_request_timeout').with_value(60) }
it { is_expected.to contain_octavia_config('driver_agent/stats_max_processes').with_value(10) }
it { is_expected.to contain_octavia_config('driver_agent/get_request_timeout').with_value(60) }
it { is_expected.to contain_octavia_config('driver_agent/get_max_processes').with_value(10) }
it { is_expected.to contain_octavia_config('driver_agent/max_process_warning_percent').with_value(0.60) }
it { is_expected.to contain_octavia_config('driver_agent/provider_agent_shutdown_timeout').with_value(60) }
it { is_expected.to contain_octavia_config('driver_agent/enabled_provider_agents').with_value(['agent-a', 'agent-b']) }
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-driver-agent'
end
end
end