From 02965a6077da2c10f936cbf3d5d262cc96bdf489 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 11 Jul 2022 16:10:08 +0900 Subject: [PATCH] Allow (more) customization of amphora log offloading This change extends coverage of [amphora_agent] options so that users can customize these parameters. Especially the log_protocol parameter is required to use TCP protocol instead of UDP protocol for log transferring, for more robust logging. Change-Id: I697fdbef762c69bb1494eae1cfa8252a2bd2c9b3 --- manifests/controller.pp | 31 +++++++++++++++++++ ...-log-offloading-opts-4aac954e374e75ff.yaml | 11 +++++++ spec/classes/octavia_controller_spec.rb | 15 +++++++++ 3 files changed, 57 insertions(+) create mode 100644 releasenotes/notes/amphora-log-offloading-opts-4aac954e374e75ff.yaml diff --git a/manifests/controller.pp b/manifests/controller.pp index 96e89f3d..7f280fc4 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -179,6 +179,27 @@ # (optional) The tenant traffic flow log format string. # Defaults to $::os_service_default # +# [*log_protocol*] +# (optional) The log forwarding transport protoocl. One of UDP or TCP. +# Defaults to $::os_service_default +# +# [*log_retry_count*] +# (optional) The maximum attempts to retry connecting to the logging host. +# Defaults to $::os_service_default +# +# [*log_retry_interval*] +# (optional) The time, in seconds, to wait between retries connecting to +# the logging host. +# Defaults to $::os_service_default +# +# [*log_queue_size*] +# (optional) The queue size (messages) to buffer log messages. +# Defaults to $::os_service_default +# +# [*logging_template_override*] +# (optional) Custom logging configuration template. +# Defaults to $::os_service_default +# # [*disable_local_log_storage*] # (optional) When true, logs will not be stored on the amphora filesystem. # This includes all kernel, system, and security logs. @@ -268,6 +289,11 @@ class octavia::controller ( $tenant_log_targets = $::os_service_default, $user_log_facility = $::os_service_default, $user_log_format = $::os_service_default, + $log_protocol = $::os_service_default, + $log_retry_count = $::os_service_default, + $log_retry_interval = $::os_service_default, + $log_queue_size = $::os_service_default, + $logging_template_override = $::os_service_default, $disable_local_log_storage = $::os_service_default, $vrrp_advert_int = $::os_service_default, $vrrp_check_interval = $::os_service_default, @@ -343,6 +369,11 @@ Use the octavia::networking class instead') 'amphora_agent/tenant_log_targets' : value => join(any2array($tenant_log_targets), ','); 'amphora_agent/user_log_facility' : value => $user_log_facility; 'haproxy_amphora/user_log_format' : value => $user_log_format; + 'amphora_agent/log_protocol' : value => $log_protocol; + 'amphora_agent/log_retry_count' : value => $log_retry_count; + 'amphora_agent/log_retry_interval' : value => $log_retry_interval; + 'amphora_agent/log_queue_size' : value => $log_queue_size; + 'amphora_agent/logging_template_override' : value => $logging_template_override; 'amphora_agent/disable_local_log_storage' : value => $disable_local_log_storage; 'keepalived_vrrp/vrrp_advert_int' : value => $vrrp_advert_int; 'keepalived_vrrp/vrrp_check_interval' : value => $vrrp_check_interval; diff --git a/releasenotes/notes/amphora-log-offloading-opts-4aac954e374e75ff.yaml b/releasenotes/notes/amphora-log-offloading-opts-4aac954e374e75ff.yaml new file mode 100644 index 00000000..e29370e5 --- /dev/null +++ b/releasenotes/notes/amphora-log-offloading-opts-4aac954e374e75ff.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + The ``octavia::controller`` class now supports the following parameters, + to customize behavior of the log offloading feature. + + - ``log_protocol`` + - ``log_retry_count`` + - ``log_retry_interval`` + - ``log_queue_size`` + - ``logging_template_override`` diff --git a/spec/classes/octavia_controller_spec.rb b/spec/classes/octavia_controller_spec.rb index ad2aa14e..778fa44c 100644 --- a/spec/classes/octavia_controller_spec.rb +++ b/spec/classes/octavia_controller_spec.rb @@ -51,6 +51,11 @@ describe 'octavia::controller' do :tenant_log_targets => ['192.0.2.1:10514', '2001:db8:1::10:10514'], :user_log_facility => 3, :user_log_format => '{{ project_id }} {{ lb_id }}', + :log_protocol => 'TCP', + :log_retry_count => 5, + :log_retry_interval => 2, + :log_queue_size => 10000, + :logging_template_override => 'mycustomtemplate', :disable_local_log_storage => true, :vrrp_advert_int => 1, :vrrp_check_interval => 5, @@ -103,6 +108,11 @@ describe 'octavia::controller' do is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('192.0.2.1:10514,2001:db8:1::10:10514') is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value(3) is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('{{ project_id }} {{ lb_id }}') + is_expected.to contain_octavia_config('amphora_agent/log_protocol').with_value('TCP') + is_expected.to contain_octavia_config('amphora_agent/log_retry_count').with_value(5) + is_expected.to contain_octavia_config('amphora_agent/log_retry_interval').with_value(2) + is_expected.to contain_octavia_config('amphora_agent/log_queue_size').with_value(10000) + is_expected.to contain_octavia_config('amphora_agent/logging_template_override').with_value('mycustomtemplate') is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value(true) is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value(1) is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value(5) @@ -156,6 +166,11 @@ describe 'octavia::controller' do is_expected.to contain_octavia_config('amphora_agent/tenant_log_targets').with_value('') is_expected.to contain_octavia_config('amphora_agent/user_log_facility').with_value('') is_expected.to contain_octavia_config('haproxy_amphora/user_log_format').with_value('') + is_expected.to contain_octavia_config('amphora_agent/log_protocol').with_value('') + is_expected.to contain_octavia_config('amphora_agent/log_retry_count').with_value('') + is_expected.to contain_octavia_config('amphora_agent/log_retry_interval').with_value('') + is_expected.to contain_octavia_config('amphora_agent/log_queue_size').with_value('') + is_expected.to contain_octavia_config('amphora_agent/logging_template_override').with_value('') is_expected.to contain_octavia_config('amphora_agent/disable_local_log_storage').with_value('') is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_advert_int').with_value('') is_expected.to contain_octavia_config('keepalived_vrrp/vrrp_check_interval').with_value('')