Add override variables for plugin

Allow a plugin to override the admin and public addresses using
swift_hash:

- swift_hash['management_vip']
- swift_hash['public_vip']

Partially implements: blueprint detach-components-from-controllers
Change-Id: I90f727451081052c14e0bea896f6faab01f15486
This commit is contained in:
Daniel Depaoli
2015-11-09 18:40:58 +01:00
parent 0db9fb73a6
commit 7d5df5950b
3 changed files with 24 additions and 6 deletions

View File

@@ -2,11 +2,17 @@ notice('MODULAR: swift/keystone.pp')
$swift_hash = hiera_hash('swift', {})
$public_vip = hiera('public_vip')
$admin_address = hiera('management_vip')
# Allow a plugin to override the admin address using swift_hash:
$admin_address = pick($swift_hash['management_vip'], hiera('management_vip'))
$region = pick($swift_hash['region'], hiera('region', 'RegionOne'))
$public_ssl_hash = hiera('public_ssl')
$public_address = $public_ssl_hash['services'] ? {
true => $public_ssl_hash['hostname'],
# Allow a plugin to override the public address using swift_hash:
# TODO(sbog): with this approach you must use IP address in SAN field of
# certificate on external swift. Change this in next iterations of TLS
# implementation.
true => pick($swift_hash['public_vip'],
$public_ssl_hash['hostname']),
default => $public_vip,
}
$public_protocol = $public_ssl_hash['services'] ? {

View File

@@ -836,6 +836,8 @@ metadata:
status: discover
swift:
user_password: Dik6hafM81P9KQrqWtOXTnTp
management_vip: 10.20.30.40
public_vip: 50.60.70.80
repo_setup:
installer_kernel:
local: "/var/www/nailgun/ubuntu/x86_64/images/linux"

View File

@@ -8,15 +8,25 @@ describe manifest do
contain_class('swift::keystone::auth')
end
public_vip = Noop.hiera('public_vip')
admin_address = Noop.hiera('management_vip')
swift = Noop.hiera_structure('swift')
public_ssl = Noop.hiera_structure('public_ssl/services')
public_address = false
if swift['management_vip']
admin_address = swift['management_vip']
else
admin_address = Noop.hiera('management_vip')
end
if swift['public_vip']
public_address = swift['public_vip']
end
if public_ssl
public_address = Noop.hiera_structure('public_ssl/hostname')
public_address = public_address || Noop.hiera_structure('public_ssl/hostname')
public_protocol = 'https'
else
public_address = public_vip
public_address = Noop.hiera('public_vip')
public_protocol = 'http'
end