Commit 210457a5 authored by ale's avatar ale
Browse files

Add service discovery names for a fake "host" global service

This makes it possible to use the common-overlay logic to reach other
hosts, by name, over the overlay network if present.

Implements the first part of issue #107.
parent 945e8eef
......@@ -251,11 +251,23 @@ def _service_dns(src_host, service_name, service, inventory, assignments):
return dns
# Build a fake 'host' service used to point at the common-overlay
# address for each host.
def _hosts_dns(src_host, inventory, assignments):
dns = {}
for hostname in inventory['hosts']:
overlay = _common_net_overlay(src_host, hostname, inventory)
addrs = _host_net_overlay_addrs(hostname, inventory, overlay)
dns[hostname + '.host'] = addrs
return dns
# Build the full service discovery DNS map for host 'name'.
def _host_service_dns_map(name, inventory, services, assignments):
dns = {}
for s in assignments.all_services():
dns.update(_service_dns(name, s, services[s], inventory, assignments))
dns.update(_hosts_dns(name, inventory, assignments))
return dns
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment