Add ability to specify api host/port in config file

Add the ability to override the default listen IP/port for the api
service in the config file.
Use the ['telemetry-api-bind'] namespace to derive these values

Implements blueprint increase-ip-binding-flexibility

Change-Id: Ic98c4a0641a75b2b56b19c90145e0b8c209cfd9b
This commit is contained in:
Darren Birkett 2014-04-25 11:18:46 +01:00
parent 4f6cd0a518
commit 2e911759f1
7 changed files with 40 additions and 12 deletions

View File

@ -5,13 +5,13 @@
},
"openstack-common": {
"locked_version": "8.5.0",
"git": "git://github.com/stackforge/cookbook-openstack-common.git",
"ref": "3e68d2e9bace0adfcc4a4907611c8c3ee573a7ce"
"git": "https://github.com/stackforge/cookbook-openstack-common.git",
"ref": "3e9264d94b0cc0d30705408aa82ae538c482d2bb"
},
"openstack-identity": {
"locked_version": "8.1.3",
"git": "git://github.com/stackforge/cookbook-openstack-identity.git",
"ref": "145a716611dda6414d8458071f8fbccf9e5c978c"
"locked_version": "8.1.4",
"git": "https://github.com/stackforge/cookbook-openstack-identity.git",
"ref": "d3d1e34a63e2fe5f3764149a38378070956e1756"
},
"apt": {
"locked_version": "2.3.8"

View File

@ -2,9 +2,12 @@ openstack-telemetry Cookbook CHANGELG
==============================
This file is used to list changes made in each version of the openstack-metering cookbook.
## 8.4.1
* Add ability to specify local bind IP/port for api service
## 8.4.0
### Blue print
# Use the library method auth_uri_transform
### Blueprint
* Use the library method auth_uri_transform
## 8.3.0
* Rename openstack-metering to openstack-telemetry

View File

@ -49,6 +49,15 @@ Attributes
* `openstack['telemetry']['api']['auth']['version']` - Select v2.0 or v3.0. Default v2.0. The auth API version used to interact with identity service.
The following attributes are defined in attributes/default.rb of the common cookbook, but are documented here due to their relevance:
* `openstack['endpoints']['telemetry-api-bind']['host']` - The IP address to bind the api service to
* `openstack['endpoints']['telemetry-api-bind']['port']` - The port to bind the api service to
* `openstack['endpoints']['telemetry-api-bind']['bind_interface']` - The interface name to bind the api service to
If the value of the 'bind_interface' attribute is non-nil, then the telemetry service will be bound to the first IP address on that interface. If the value of the 'bind_interface' attribute is nil, then the telemetry service will be bound to the IP address specified in>
Testing
=====

View File

@ -4,7 +4,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
license 'Apache 2.0'
description 'The OpenStack Metering service Ceilometer.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '8.4.0'
version '8.4.1'
recipe 'openstack-telemetry::agent-central', 'Installs agent central service.'
recipe 'openstack-telemetry::agent-compute', 'Installs agent compute service.'

View File

@ -52,6 +52,7 @@ service_tenant = node['openstack']['telemetry']['service_tenant_name']
identity_endpoint = endpoint 'identity-api'
identity_admin_endpoint = endpoint 'identity-admin'
image_endpoint = endpoint 'image-api'
telemetry_api_bind = endpoint 'telemetry-api-bind'
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['telemetry']['api']['auth']['version']
@ -86,7 +87,9 @@ template node['openstack']['telemetry']['conf'] do
service_pass: service_pass,
service_tenant_name: service_tenant,
service_user: service_user,
metering_secret: metering_secret
metering_secret: metering_secret,
api_bind_host: telemetry_api_bind.host,
api_bind_port: telemetry_api_bind.port
)
end

View File

@ -150,6 +150,18 @@ describe 'openstack-telemetry::common' do
r = /^metering_secret = metering_secret$/
expect(chef_run).to render_file(file.name).with_content(r)
end
it 'has bind_host set' do
node.set['openstack']['endpoints']['telemetry-api-bind']['host'] = '1.1.1.1'
expect(chef_run).to render_file(file.name).with_content(
/^host = 1.1.1.1$/)
end
it 'has bind_port set' do
node.set['openstack']['endpoints']['telemetry-api-bind']['port'] = '9999'
expect(chef_run).to render_file(file.name).with_content(
/^port = 9999$/)
end
end
describe 'policy.json' do

View File

@ -1,7 +1,4 @@
[DEFAULT]
<% if node["openstack"]["telemetry"]["host"] %>
host = <%= node["openstack"]["telemetry"]["host"] %>
<% end %>
os_auth_url = <%= @auth_uri %>
os_tenant_name = <%= @service_tenant_name %>
os_password = <%= @service_pass %>
@ -52,6 +49,10 @@ qpid_tcp_nodelay=<%= node["openstack"]["mq"]["telemetry"]["qpid"]["tcp_nodelay"]
glance_registry_host = <%= @image_endpoint.host %>
periodic_interval = <%= node["openstack"]["telemetry"]["periodic_interval"] %>
[api]
host = <%= @api_bind_host %>
port = <%= @api_bind_port %>
[keystone_authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_uri = <%= @auth_uri %>