Add support for DLO configuration.
New class swift::proxy::dlo for DLO configuration. Add acceptance tests Add docs to README Change-Id: Ie209e494d7affd72c3fea3f2cc3459b91d7c6765
This commit is contained in:
22
README.md
22
README.md
@@ -126,6 +126,28 @@ This is the ip that the proxy service will bind to when it starts.
|
|||||||
####`port`
|
####`port`
|
||||||
The port for which the proxy service will bind to when it starts.
|
The port for which the proxy service will bind to when it starts.
|
||||||
|
|
||||||
|
### Class swift::proxy::dlo
|
||||||
|
|
||||||
|
Configures [DLO middleware](http://docs.openstack.org/developer/swift/middleware.html#module-swift.common.middleware.dlo) for swift proxy.
|
||||||
|
|
||||||
|
```puppet
|
||||||
|
class { '::swift::proxy::dlo':
|
||||||
|
rate_limit_after_segment => '10',
|
||||||
|
rate_limit_segments_per_sec => '1',
|
||||||
|
max_get_time => '86400'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
####`rate_limit_after_segment`
|
||||||
|
Start rate-limiting DLO segment serving after the Nth segment of a segmented object.
|
||||||
|
|
||||||
|
####`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.
|
||||||
|
|
||||||
|
####`max_get_time`
|
||||||
|
Time limit on GET requests (seconds).
|
||||||
|
|
||||||
### Class: swift::storage
|
### Class: swift::storage
|
||||||
|
|
||||||
Class that sets up all of the configuration and dependencies for swift storage server instances.
|
Class that sets up all of the configuration and dependencies for swift storage server instances.
|
||||||
|
43
manifests/proxy/dlo.pp
Normal file
43
manifests/proxy/dlo.pp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# Configure swift dlo.
|
||||||
|
#
|
||||||
|
# == Examples
|
||||||
|
#
|
||||||
|
# include ::swift::proxy::dlo
|
||||||
|
#
|
||||||
|
# == Parameters
|
||||||
|
#
|
||||||
|
# [*rate_limit_after_segment*]
|
||||||
|
# Start rate-limiting DLO segment serving after the Nth segment of a segmented object.
|
||||||
|
# Default 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 1.
|
||||||
|
#
|
||||||
|
# [*max_get_time*]
|
||||||
|
# Time limit on GET requests (seconds).
|
||||||
|
# Default to 86400.
|
||||||
|
#
|
||||||
|
# == Authors
|
||||||
|
#
|
||||||
|
# Aleksandr Didenko adidenko@mirantis.com
|
||||||
|
#
|
||||||
|
# == Copyright
|
||||||
|
#
|
||||||
|
# Copyright 2015 Mirantis Inc, unless otherwise noted.
|
||||||
|
#
|
||||||
|
class swift::proxy::dlo (
|
||||||
|
$rate_limit_after_segment = '10',
|
||||||
|
$rate_limit_segments_per_sec = '1',
|
||||||
|
$max_get_time = '86400'
|
||||||
|
) {
|
||||||
|
|
||||||
|
concat::fragment { 'swift_dlo':
|
||||||
|
target => '/etc/swift/proxy-server.conf',
|
||||||
|
content => template('swift/proxy/dlo.conf.erb'),
|
||||||
|
order => '36',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -105,14 +105,17 @@ describe 'basic swift' do
|
|||||||
}
|
}
|
||||||
class { '::swift::proxy':
|
class { '::swift::proxy':
|
||||||
proxy_local_net_ip => '127.0.0.1',
|
proxy_local_net_ip => '127.0.0.1',
|
||||||
pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'],
|
pipeline => ['healthcheck', 'cache', 'tempauth', 'dlo', 'proxy-server'],
|
||||||
account_autocreate => true,
|
account_autocreate => true,
|
||||||
require => Class['swift::ringbuilder'],
|
require => Class['swift::ringbuilder'],
|
||||||
}
|
}
|
||||||
class { '::swift::proxy::authtoken':
|
class { '::swift::proxy::authtoken':
|
||||||
admin_password => 'a_big_secret',
|
admin_password => 'a_big_secret',
|
||||||
}
|
}
|
||||||
class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: }
|
class {
|
||||||
|
[ '::swift::proxy::healthcheck', '::swift::proxy::cache',
|
||||||
|
'::swift::proxy::tempauth', '::swift::proxy::dlo' ]:
|
||||||
|
}
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
|
||||||
|
48
spec/classes/swift_proxy_dlo_spec.rb
Normal file
48
spec/classes/swift_proxy_dlo_spec.rb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'swift::proxy::dlo' do
|
||||||
|
|
||||||
|
let :facts do
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :fragment_file do
|
||||||
|
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/36_swift_dlo"
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when using default parameters" do
|
||||||
|
it 'should build the fragment with correct parameters' do
|
||||||
|
verify_contents(catalogue, fragment_file,
|
||||||
|
[
|
||||||
|
'[filter:dlo]',
|
||||||
|
'use = egg:swift#dlo',
|
||||||
|
'rate_limit_after_segment = 10',
|
||||||
|
'rate_limit_segments_per_sec = 1',
|
||||||
|
'max_get_time = 86400',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when overriding default parameters" do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rate_limit_after_segment => '30',
|
||||||
|
:rate_limit_segments_per_sec => '5',
|
||||||
|
:max_get_time => '6400',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it 'should build the fragment with correct parameters' do
|
||||||
|
verify_contents(catalogue, fragment_file,
|
||||||
|
[
|
||||||
|
'[filter:dlo]',
|
||||||
|
'use = egg:swift#dlo',
|
||||||
|
'rate_limit_after_segment = 30',
|
||||||
|
'rate_limit_segments_per_sec = 5',
|
||||||
|
'max_get_time = 6400',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
6
templates/proxy/dlo.conf.erb
Normal file
6
templates/proxy/dlo.conf.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
[filter:dlo]
|
||||||
|
use = egg:swift#dlo
|
||||||
|
rate_limit_after_segment = <%= @rate_limit_after_segment %>
|
||||||
|
rate_limit_segments_per_sec = <%= @rate_limit_segments_per_sec %>
|
||||||
|
max_get_time = <%= @max_get_time %>
|
Reference in New Issue
Block a user