Commit f9fc86ee authored by ale's avatar ale
Browse files

Merge branch 'overlay-host-names' into 'master'

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

See merge request !206
parents 945e8eef 122f46f0
Pipeline #16710 passed with stages
in 6 minutes and 10 seconds
......@@ -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
......
......@@ -2,7 +2,7 @@
{% macro targets_for_group(group, port) %}
- targets:
{% for host in groups[group]|sort %}
- "{{ host }}:{{ port }}"
- "{{ host }}.host.{{ domain }}:{{ port }}"
{% endfor %}
{% endmacro %}
......
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