Fix middleware order of proxy pipeline and add missing modules

This patch fixes the order of the middlewares defined in the Swift proxy
server pipeline.

Sources for the order:
https://github.com/openstack/swift/blob/master/etc/proxy-server.conf-sample#L91-L99
http://docs.openstack.org/developer/swift/middleware.html#
https://github.com/openstack/swift3/blob/master/etc/proxy-server.conf-sample#L9
https://github.com/openstack/ceilometermiddleware/blob/master/ceilometermiddleware/swift.py#L21-L22

These are all values in order:

 10 catch_errors
 20 gatekeeper
 30 healthcheck
 40 (reserved for proxy_logging, see below)
 50 cache
 60 container_sync
 70 swift3
 80 s3token
 90 ratelimit
100 crossdomain
110 bulk
120 tempurl
130 formpost
140 copy
150 tempauth
160 swauth
170 authtoken
180 keystone
190 staticweb
200 copy
210 account_quotas
220 container_quotas
230 slo
240 dlo
250 versioned_writes
260 ceilometer
270 proxy-logging
280 proxy-server

The copy and versioned_writes middlewares have been added too.

The proxy_logging should be added a second time at position 40, but the
actual value is 270 to have the final proxy-logging just before the
proxy-server.

Also renamed the suffix 'swauth' in the 'tempauth' manifest to be
'tempauth'; 'swauth' is used in a different manifest.

Closes-Bug: 1618514
Change-Id: I99433720e32dc3557b809c8d42ce3d5981c199c3
This commit is contained in:
Christian Schwede 2016-08-30 17:33:26 +02:00
parent 3eb1b82a4d
commit da01dd7bd0
31 changed files with 167 additions and 37 deletions

View File

@ -24,6 +24,6 @@ class swift::proxy::account_quotas() {
concat::fragment { 'swift_account_quotas':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/account_quotas.conf.erb'),
order => '80',
order => '210',
}
}

View File

@ -146,7 +146,7 @@ class swift::proxy::authtoken(
concat::fragment { 'swift_authtoken':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/authtoken.conf.erb'),
order => '22',
order => '170',
}
}

View File

@ -49,6 +49,6 @@ class swift::proxy::bulk(
concat::fragment { 'swift_bulk':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/bulk.conf.erb'),
order => '21',
order => '110',
}
}

View File

@ -32,7 +32,7 @@ class swift::proxy::cache(
concat::fragment { 'swift_cache':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/cache.conf.erb'),
order => '23',
order => '50',
}
}

View File

@ -22,7 +22,7 @@ class swift::proxy::catch_errors() {
concat::fragment { 'swift_catch_errors':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/catch_errors.conf.erb'),
order => '24',
order => '10',
}
}

View File

@ -102,7 +102,7 @@ class swift::proxy::ceilometer(
concat::fragment { 'swift_ceilometer':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/ceilometer.conf.erb'),
order => '33',
order => '260',
require => Class['::ceilometer'],
}

View File

@ -24,6 +24,6 @@ class swift::proxy::container_quotas() {
concat::fragment { 'swift_container_quotas':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/container_quotas.conf.erb'),
order => '81',
order => '220',
}
}

View File

@ -9,6 +9,6 @@ class swift::proxy::container_sync() {
concat::fragment { 'swift_container_sync':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/container_sync.conf.erb'),
order => '82',
order => '60',
}
}

30
manifests/proxy/copy.pp Normal file
View File

@ -0,0 +1,30 @@
#
# Configure swift copy.
#
# == Examples
#
# include ::swift::proxy::copy
#
# == Parameters
#
# [*object_post_as_copy*]
# Set object_post_as_copy = false to turn on fast posts where only the metadata
# changes are stored anew and the original data file is kept in place. This
# makes for quicker posts.
# When object_post_as_copy is set to true, a POST request will be transformed
# into a COPY request where source and destination objects are the same. This
# is the current default in Swift.
#
class swift::proxy::copy (
$object_post_as_copy = true
) {
include ::swift::deps
concat::fragment { 'swift_copy':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/copy.conf.erb'),
order => '140',
}
}

View File

@ -20,7 +20,7 @@ class swift::proxy::crossdomain (
concat::fragment { 'swift_crossdomain':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/crossdomain.conf.erb'),
order => '35',
order => '100',
}
}

View File

@ -39,7 +39,7 @@ class swift::proxy::dlo (
concat::fragment { 'swift_dlo':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/dlo.conf.erb'),
order => '36',
order => '240',
}
}

View File

@ -22,7 +22,7 @@ class swift::proxy::formpost() {
concat::fragment { 'swift-proxy-formpost':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/formpost.conf.erb'),
order => '31',
order => '130',
}
}

View File

@ -48,7 +48,7 @@ class swift::proxy::gatekeeper(
concat::fragment { 'swift_gatekeeper':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/gatekeeper.conf.erb'),
order => '34',
order => '20',
}
}

View File

@ -20,7 +20,7 @@ class swift::proxy::healthcheck() {
concat::fragment { 'swift_healthcheck':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/healthcheck.conf.erb'),
order => '25',
order => '30',
}
}

View File

@ -39,7 +39,7 @@ class swift::proxy::keystone(
concat::fragment { 'swift_keystone':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/keystone.conf.erb'),
order => '79',
order => '180',
}
}

View File

@ -12,6 +12,6 @@ class swift::proxy::proxy_logging {
concat::fragment { 'swift_proxy-logging':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/proxy-logging.conf.erb'),
order => '27',
order => '270',
}
}

View File

@ -53,7 +53,7 @@ class swift::proxy::ratelimit(
concat::fragment { 'swift_ratelimit':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/ratelimit.conf.erb'),
order => '26',
order => '90',
}
}

View File

@ -39,6 +39,6 @@ class swift::proxy::s3token(
concat::fragment { 'swift_s3token':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/s3token.conf.erb'),
order => '28',
order => '80',
}
}

View File

@ -54,7 +54,7 @@ class swift::proxy::slo (
concat::fragment { 'swift_slo':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/slo.conf.erb'),
order => '35',
order => '230',
}
}

View File

@ -23,7 +23,7 @@ class swift::proxy::staticweb() {
concat::fragment { 'swift-proxy-staticweb':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/staticweb.conf.erb'),
order => '32',
order => '190',
}
}

View File

@ -32,7 +32,7 @@ class swift::proxy::swauth(
concat::fragment { 'swift_proxy_swauth':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/swauth.conf.erb'),
order => '20',
order => '160',
}
}

View File

@ -36,7 +36,7 @@ class swift::proxy::swift3(
concat::fragment { 'swift_swift3':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/swift3.conf.erb'),
order => '27',
order => '70',
}
}

View File

@ -105,10 +105,10 @@ class swift::proxy::tempauth (
validate_re($storage_url_scheme, ['http','https','default'])
}
concat::fragment { 'swift-proxy-swauth':
concat::fragment { 'swift-proxy-tempauth':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/tempauth.conf.erb'),
order => '01',
order => '150',
}
}

View File

@ -97,7 +97,7 @@ class swift::proxy::tempurl (
concat::fragment { 'swift-proxy-tempurl':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/tempurl.conf.erb'),
order => '29',
order => '120',
}
}

View File

@ -0,0 +1,26 @@
#
# Configure Swift versioned_writes.
#
# == Examples
#
# include ::swift::proxy::versioned_writes
#
# == Parameters
#
# [*allow_versioned_writes*]
# Enables using versioned writes middleware and exposing configuration
# settings via HTTP GET /info.
#
class swift::proxy::versioned_writes (
$allow_versioned_writes = false
) {
include ::swift::deps
concat::fragment { 'swift_versioned_writes':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/versioned_writes.conf.erb'),
order => '250',
}
}

View File

@ -0,0 +1,6 @@
---
fixes:
- Fix the middleware order in the proxy server pipeline according to
upstream documentation
features:
- Add missing copy and versioned_writes middlewares

View File

@ -0,0 +1,30 @@
require 'spec_helper'
describe 'swift::proxy::copy' do
let :facts do
{}
end
describe "when using default parameters" do
it 'should build the fragment with correct parameters' do
is_expected.to contain_concat_fragment('swift_copy').with_content('
[filter:copy]
use = egg:swift#copy
object_post_as_copy = true
')
end
end
describe "when overriding default parameters" do
let :params do
{
:object_post_as_copy => false,
}
end
it 'should build the fragment with correct parameters' do
is_expected.to contain_concat_fragment('swift_copy').with_content(/object_post_as_copy = false/)
end
end
end

View File

@ -19,13 +19,13 @@ describe 'swift::proxy::tempauth' do
'concat { "/etc/swift/proxy-server.conf": }'
end
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/\[filter:tempauth\]\nuse = egg:swift#tempauth/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/\[filter:tempauth\]\nuse = egg:swift#tempauth/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/user_admin_admin = admin \.admin \.reseller_admin/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/token_life/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme/) }
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin \.admin \.reseller_admin/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/reseller_prefix/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/token_life/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/auth_prefix/) }
it { is_expected.to_not contain_concat_fragment('swift-proxy-tempauth').with_content(/storage_url_scheme/) }
context 'declaring two users' do
let :params do {
@ -44,10 +44,10 @@ describe 'swift::proxy::tempauth' do
},
]
} end
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(
/user_admin_admin = admin \.admin \.reseller_admin/
) }
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(
/user_bar_foo = pass \.reseller_admin/
) }
end
@ -63,7 +63,7 @@ describe 'swift::proxy::tempauth' do
},
]
} end
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/user_admin_admin = admin $/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/user_admin_admin = admin $/) }
end
@ -76,10 +76,10 @@ describe 'swift::proxy::tempauth' do
}.merge(default_params)
end
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/reseller_prefix = AUTH/) }
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/token_life = 81600/) }
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/auth_prefix = \/auth\//) }
it { is_expected.to contain_concat_fragment('swift-proxy-swauth').with_content(/storage_url_scheme = http/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/reseller_prefix = AUTH/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/token_life = 81600/) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/auth_prefix = \/auth\//) }
it { is_expected.to contain_concat_fragment('swift-proxy-tempauth').with_content(/storage_url_scheme = http/) }
describe "invalid params" do
['account_user_list', 'token_life', 'auth_prefix', 'storage_url_scheme'].each do |param|

View File

@ -0,0 +1,30 @@
require 'spec_helper'
describe 'swift::proxy::versioned_writes' do
let :facts do
{}
end
describe "when using default parameters" do
it 'should build the fragment with correct parameters' do
is_expected.to contain_concat_fragment('swift_versioned_writes').with_content('
[filter:versioned_writes]
use = egg:swift#versioned_writes
allow_versioned_writes = false
')
end
end
describe "when overriding default parameters" do
let :params do
{
:allow_versioned_writes => true,
}
end
it 'should build the fragment with correct parameters' do
is_expected.to contain_concat_fragment('swift_versioned_writes').with_content(/allow_versioned_writes = true/)
end
end
end

View File

@ -0,0 +1,4 @@
[filter:copy]
use = egg:swift#copy
object_post_as_copy = <%= @object_post_as_copy %>

View File

@ -0,0 +1,4 @@
[filter:versioned_writes]
use = egg:swift#versioned_writes
allow_versioned_writes = <%= @allow_versioned_writes %>