Merge "Update s3api configuration"

This commit is contained in:
Zuul 2018-05-05 02:20:20 +00:00 committed by Gerrit Code Review
commit f1eb889670
6 changed files with 96 additions and 21 deletions

27
manifests/proxy/s3api.pp Normal file
View File

@ -0,0 +1,27 @@
#
# Configure swift s3api.
#
# == Dependencies
#
# == Parameters
#
# [*ensure*]
# Enable or not s3api middleware
# Defaults to 'present'
#
# [*auth_pipeline_check*]
# Enable pipeline order check
# Defaults to 'false'
#
class swift::proxy::s3api(
$ensure = 'present',
$auth_pipeline_check = false
) {
include ::swift::deps
swift_proxy_config {
'filter:s3api/use': value => 'egg:swift#s3api';
'filter:s3api/auth_pipeline_check': value => $auth_pipeline_check;
}
}

View File

@ -6,15 +6,19 @@
#
# [*auth_host*]
# (optional) The keystone host
# Defaults to 127.0.0.1
# Defaults to undef.
#
# [*auth_port*]
# (optional) The Keystone client API port
# Defaults to 5000
# Defaults to undef.
#
# [*auth_protocol*]
# (optional) http or https
# Defaults to http
# Defaults to undef.
#
# [*auth_uri*]
# (optional) The Keystone server uri
# Defaults to http://127.0.0.1:35357
#
# == Dependencies
#
@ -29,17 +33,25 @@
# Copyright 2012 eNovance licensing@enovance.com
#
class swift::proxy::s3token(
$auth_host = '127.0.0.1',
$auth_port = '35357',
$auth_protocol = 'http'
$auth_host = undef,
$auth_port = undef,
$auth_protocol = undef,
$auth_uri = 'http://127.0.0.1:35357'
) {
include ::swift::deps
if $auth_host and $auth_port and $auth_protocol {
warning('Use of the auth_host, auth_port, and auth_protocol options have been deprecated in favor of auth_uri.')
$auth_uri_real = "${auth_protocol}://${auth_host}:${auth_port}"
} else {
$auth_uri_real = $auth_uri
}
swift_proxy_config {
'filter:s3token/paste.filter_factory': value => 'keystonemiddleware.s3_token:filter_factory';
'filter:s3token/auth_host': value => $auth_host;
'filter:s3token/auth_port': value => $auth_port;
'filter:s3token/auth_protocol': value => $auth_protocol;
'filter:s3token/use': value => 'egg:swift#s3token';
'filter:s3token/auth_uri': value => $auth_uri_real;
}
}

View File

@ -6,7 +6,7 @@
# == Parameters
#
# [*ensure*]
# Enable or not ceilometer fragment
# Enable or not swift3 middleware
# Defaults to 'present'
#
# == Examples

View File

@ -0,0 +1,16 @@
---
prelude: >
Swift has now merged the swift3 middleware into its own source tree and
renamed it to s3api.
features:
- |
The s3api middleware provides S3API support to a Swift cluster.
upgrade:
- |
For previous users of Swift3 middleware, it is a simple change to use
the s3api middleware, no APIs have been changed. Simply substitute in the
new middleware in the pipeline and remember to add the filter.
deprecations:
- |
In s3token middleware, the use of auth_host, auth_port and auth_protocol
have been deprecated in favor of auth_uri

View File

@ -0,0 +1,15 @@
require 'spec_helper'
describe 'swift::proxy::s3api' do
let :facts do
OSDefaults.get_facts({
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
})
end
it { is_expected.to contain_swift_proxy_config('filter:s3api/use').with_value('egg:swift#s3api') }
it { is_expected.to contain_swift_proxy_config('filter:s3api/auth_pipeline_check').with_value('false') }
end

View File

@ -7,23 +7,28 @@ describe 'swift::proxy::s3token' do
end
describe "when using default parameters" do
it { is_expected.to contain_swift_proxy_config('filter:s3token/paste.filter_factory').with_value('keystonemiddleware.s3_token:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_port').with_value('35357') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_protocol').with_value('http') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_host').with_value('127.0.0.1') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/use').with_value('egg:swift#s3token') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://127.0.0.1:35357') }
end
describe "when overriding default parameters" do
let :params do
{
:auth_port => 4212,
:auth_protocol => 'https',
:auth_host => '1.2.3.4'
:auth_protocol => 'https',
:auth_host => '192.168.4.2',
:auth_port => '3452'
}
end
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_port').with_value('4212') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_protocol').with_value('https') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_host').with_value('1.2.3.4') }
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('https://192.168.4.2:3452') }
end
describe "when overriding default parameters" do
let :params do
{
:auth_uri => 'http://192.168.24.11:35357'
}
end
it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://192.168.24.11:35357') }
end
end