From 400008ae9d1bfb4d3a0916e72fc2494ca4fd450b Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Mon, 15 Apr 2019 19:04:59 +0200 Subject: [PATCH] desginate: simplify sample pool and modify it for HA (SCRD-9142) in crowbar's world the dns-master is the master of all and slaves forward all queries to dns-master. Under such a configuration there is no need to query other nameservers as they still forward the query to dns-master. So designate can just verify on one nameserver(dns-master) and dns-master will take care of passing that info to all slaves. Same goes for also_notifies: dns-master will notify all slaves in case of either zone or recordset is updated/deleted. this also further simplifies the designate pool config reducing the time required to create zone and recordsets. Also having multiple nameservers confuses designate in some cases as according to these nameserver designate is not authoritative of some zones and recordsets. hiddenmasters are designate-mdns services, in HA this service will be running on multiple hosts and any host can be asked to update the zone (when a recordset, corresponding to a vm is created) on th real-master so all have to be listed as master in the pool. The host with VIP will use that ip as the outgoing ip when connecting to the real-master, so it should also be named as master for the zone --- chef/cookbooks/designate/recipes/mdns.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/chef/cookbooks/designate/recipes/mdns.rb b/chef/cookbooks/designate/recipes/mdns.rb index 16ff8ceba8..0f3dd67722 100644 --- a/chef/cookbooks/designate/recipes/mdns.rb +++ b/chef/cookbooks/designate/recipes/mdns.rb @@ -20,10 +20,18 @@ dns = node_search_with_cache("roles:dns-server").first dnsmaster = dns[:dns][:master_ip] -dnsslaves = dns[:dns][:slave_ips].to_a -dnsservers = [dnsmaster] + dnsslaves -network_settings = DesignateHelper.network_settings(node) +# hidden masters are designate-mdns services, in ha this service will be running on multiple +# hosts and any host can be asked to update the zone (when a recordset, corsspoding to a vm is +# created) on the real-master so all have to be listed as master in the pool. +hiddenmasters = node_search_with_cache("roles:designate-server").map do |n| + { "host" => Barclamp::Inventory.get_network_by_type(n, "admin").address, "port" => 5354 } +end + +# the host with VIP will use that ip as the outgoing ip when connecting to the real-master +if node[:designate][:ha][:enabled] + hiddenmasters += [{ "host" => CrowbarPacemakerHelper.cluster_vip(node, "admin"), "port" => 5354 }] +end # One could have multiple pools in desginate. And # Desginate needs to have a default pool, this pools @@ -36,16 +44,16 @@ # non-hardcoded is high enough pools = [{ "name" => "default-bind", - "description" => "Default BIND9 Pool", + "description" => "Sample Pool for designate", "id" => "794ccc2c-d751-44fe-b57f-8894c9f5c842", "attributes" => {}, "ns_records" => [{ "hostname" => "#{dns[:fqdn]}.", "priority" => 1 }], - "nameservers" => dnsservers.map { |ip| { "host" => ip, "port" => 53 } }, - "also_notifies" => dnsslaves.map { |ip| { "host" => ip, "port" => 53 } }, + "nameservers" => [{ "host" => dnsmaster, "port" => 53 }], + "also_notifies" => [], "targets" => [{ "type" => "bind9", - "description" => "BIND9 Server 1", - "masters" => [{ "host" => network_settings[:mdns_bind_host], "port" => 5354 }], + "description" => "BIND9 Server on node with role dns-server", + "masters" => hiddenmasters, "options" => { "host" => dnsmaster, "port" => 53,