-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Haproxy to use consul for service discovery
Setup Haproxy to use consul for service discovery. Earlier it was using etcd. Also, update the tests. 1. Have the openrc file used for testing use the lb.keystone.service.consul address. 2. Be way more aggressive about the test used to validate a functional haproxy instance. Ensure that it is forwarding traffic to both keystone as well as glance explicitly.
- Loading branch information
Showing
18 changed files
with
51 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
rjil::db::bind_address: "%{ipaddress_eth0}" | ||
services::db::eth0: ["%{ipaddress_eth0}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
rjil::db::bind_address: "%{ipaddress_eth2}" | ||
services::db::eth0: ["%{ipaddress_eth2}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
rjil::db::bind_address: "%{ipaddress_eth1}" | ||
services::db::eth1: ["%{ipaddress_eth1}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'net/http' | ||
require 'uri' | ||
require 'json' | ||
|
||
module Puppet::Parser::Functions | ||
newfunction( | ||
:service_discover_consul, | ||
:type => :rvalue, | ||
:doc => <<-'EOS' | ||
Given the name of a service and optionally, a tag, this function | ||
returns a hash of the form: | ||
(name => ip_address) | ||
for each host that registered that service in consul | ||
EOS | ||
) do |args| | ||
name = args.shift | ||
tag = args.shift | ||
raise(ArgumentError, "name must be specified") unless name | ||
consul_host = args.shift || '127.0.0.1' | ||
consul_port = args.shift || '8500' | ||
tag_query = tag ? "?tag=#{tag}" : '' | ||
uri = URI("http://#{consul_host}:#{consul_port}/v1/catalog/service/#{name}#{tag_query}") | ||
res = Net::HTTP.get_response(uri) | ||
if res.code == '200' | ||
results = JSON.parse(res.body) | ||
ret_hash = {} | ||
results.each do |node| | ||
ret_hash[node['Node']] = node['Address'] | ||
end | ||
ret_hash | ||
else | ||
raise(Puppet::Error, "Uri: #{uri.to_s}, returned code #{res.code}") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters