From ef9ff551315c09025d43418c80505d18bacaf44b Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 19 Dec 2021 23:26:00 +0900 Subject: [PATCH] Support more [filter:slo] parameters Change-Id: I29e118af2ad9893ab1cc42a1d6befdfa07395a20 --- manifests/proxy/slo.pp | 63 ++++++++++++++----- .../notes/slo-opts-7b4aaa369ed6fa40.yaml | 11 ++++ spec/classes/swift_proxy_slo_spec.rb | 31 ++++++--- 3 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/slo-opts-7b4aaa369ed6fa40.yaml diff --git a/manifests/proxy/slo.pp b/manifests/proxy/slo.pp index 2c8c6696..de30bad9 100644 --- a/manifests/proxy/slo.pp +++ b/manifests/proxy/slo.pp @@ -8,29 +8,54 @@ # == Parameters # # [*max_manifest_segments*] -# Max manifest segments. -# Default to 1000. +# (Optional) Max manifest segments. +# Defaults to 1000. # # [*max_manifest_size*] -# Max manifest size. -# Default to 2097152. +# (Optional) Max manifest size. +# Defaults to 2097152. # # [*min_segment_size*] -# minimal segment size -# Default to 1048576. +# (Optional) minimal segment size +# Defaults to 1048576. +# +# [*rate_limit_under_size*] +# (Optional) Rate limiting applies only to segments smaller than this size. +# Defaults to $::os_service_default. # # [*rate_limit_after_segment*] -# Start rate-limiting SLO segment serving after the Nth segment of a segmented object. -# Default to 10. +# (Optional) Start rate-limiting SLO segment serving after the Nth segment of +# a segmented object. +# Defaults to 10. # # [*rate_limit_segments_per_sec*] -# Once segment rate-limiting kicks in for an object, limit segments served to N per second. -# 0 means no rate-limiting. -# Default to 0. +# (Optional) Once segment rate-limiting kicks in for an object, limit segments +# served to N per second. 0 means no rate-limiting. +# Defaults to 0. # # [*max_get_time*] -# Time limit on GET requests (seconds). -# Default to 86400. +# (Optional) Time limit on GET requests (seconds). +# Defaults to 86400. +# +# [*concurrency*] +# (Optional) Limit how many subrequests may be executed concurrently. +# Defaults to $::os_service_default. +# +# [*delete_concurrency*] +# (Optional) Limit how many delete subrequests may be executed concurrently. +# This may be used to separately tune validation and delete concurrency +# values. +# Defaults to $::os_service_default. +# +# [*yield_frequency*] +# (Optional) Frequency, in seconds, to yield whitespace ahed of the final +# response. +# Defaults to $::os_service_default. +# +# [*allow_async_delete*] +# (Optional) Allow clients to request the object-expirer handle the deletion +# of segments using query params like `?multipart-manifest=delete&async=on`. +# Defaults to $::os_service_default. # # == Authors # @@ -44,9 +69,14 @@ class swift::proxy::slo ( $max_manifest_segments = '1000', $max_manifest_size = '2097152', $min_segment_size = '1048576', + $rate_limit_under_size = $::os_service_default, $rate_limit_after_segment = '10', $rate_limit_segments_per_sec = '0', - $max_get_time = '86400' + $max_get_time = '86400', + $concurrency = $::os_service_default, + $delete_concurrency = $::os_service_default, + $yield_frequency = $::os_service_default, + $allow_async_delete = $::os_service_default, ) { include swift::deps @@ -56,8 +86,13 @@ class swift::proxy::slo ( 'filter:slo/max_manifest_segments': value => $max_manifest_segments; 'filter:slo/max_manifest_size': value => $max_manifest_size; 'filter:slo/min_segment_size': value => $min_segment_size; + 'filter:slo/rate_limit_under_size': value => $rate_limit_under_size; 'filter:slo/rate_limit_after_segment': value => $rate_limit_after_segment; 'filter:slo/rate_limit_segments_per_sec': value => $rate_limit_segments_per_sec; 'filter:slo/max_get_time': value => $max_get_time; + 'filter:slo/concurrency': value => $concurrency; + 'filter:slo/delete_concurrency': value => $delete_concurrency; + 'filter:slo/yield_frequency': value => $yield_frequency; + 'filter:slo/allow_async_delete': value => $allow_async_delete; } } diff --git a/releasenotes/notes/slo-opts-7b4aaa369ed6fa40.yaml b/releasenotes/notes/slo-opts-7b4aaa369ed6fa40.yaml new file mode 100644 index 00000000..044b1565 --- /dev/null +++ b/releasenotes/notes/slo-opts-7b4aaa369ed6fa40.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + The following four parameters have been added to the ``swift::proxy::slo`` + class. + + - ``rate_limit_under_size`` + - ``concurrency`` + - ``delete_concurrency`` + - ``yield_frequency`` + - ``allow_async_delete`` diff --git a/spec/classes/swift_proxy_slo_spec.rb b/spec/classes/swift_proxy_slo_spec.rb index 7f24efc0..a536bcc4 100644 --- a/spec/classes/swift_proxy_slo_spec.rb +++ b/spec/classes/swift_proxy_slo_spec.rb @@ -7,25 +7,40 @@ describe 'swift::proxy::slo' do it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value('1000') } it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value('2097152') } it { is_expected.to contain_swift_proxy_config('filter:slo/min_segment_size').with_value('1048576') } + it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_under_size').with_value('') } it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value('10') } it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_segments_per_sec').with_value('0') } it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('86400') } + it { is_expected.to contain_swift_proxy_config('filter:slo/concurrency').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:slo/delete_concurrency').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:slo/yield_frequency').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:slo/allow_async_delete').with_value('') } end describe "when overriding default parameters" do let :params do { - :max_manifest_segments => '2000', - :max_manifest_size => '500000', - :rate_limit_after_segment => '30', - :max_get_time => '6400', + :max_manifest_segments => 2000, + :max_manifest_size => 500000, + :rate_limit_under_size => 1048576, + :rate_limit_after_segment => 30, + :max_get_time => 6400, + :concurrency => 2, + :delete_concurrency => 4, + :yield_frequency => 10, + :allow_async_delete => false, } end - it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value('2000') } - it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value('500000') } - it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value('30') } - it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value('6400') } + it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_segments').with_value(2000) } + it { is_expected.to contain_swift_proxy_config('filter:slo/max_manifest_size').with_value(500000) } + it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_under_size').with_value(1048576) } + it { is_expected.to contain_swift_proxy_config('filter:slo/rate_limit_after_segment').with_value(30) } + it { is_expected.to contain_swift_proxy_config('filter:slo/max_get_time').with_value(6400) } + it { is_expected.to contain_swift_proxy_config('filter:slo/concurrency').with_value(2) } + it { is_expected.to contain_swift_proxy_config('filter:slo/delete_concurrency').with_value(4) } + it { is_expected.to contain_swift_proxy_config('filter:slo/yield_frequency').with_value(10) } + it { is_expected.to contain_swift_proxy_config('filter:slo/allow_async_delete').with_value(false) } end end