From a8f2c73662ee4c73ea689492c5e3f58afe5d1168 Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Mon, 15 Apr 2019 19:04:59 +0200 Subject: [PATCH] desginate: Add mdns as hidden master (SOC-9142) In crowbar's world the dns-master is the master of all and slaves forward all queries to dns-master. When designate is enabled, designate-mdns service component(s) become the hidden master(s). We leave 'also_notifies' empty. It can be configured by the users via designate-manage utility as and when needed. designate-mdns service components, in HA, will be running on multiple hosts and any host can be asked to update a zone on th real-master. We add the cluster vip as the hidden master in case HA is enabled otherwise add all servers. --- chef/cookbooks/designate/recipes/mdns.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/chef/cookbooks/designate/recipes/mdns.rb b/chef/cookbooks/designate/recipes/mdns.rb index cfb1e04ea6..17c3ee9da7 100644 --- a/chef/cookbooks/designate/recipes/mdns.rb +++ b/chef/cookbooks/designate/recipes/mdns.rb @@ -20,15 +20,23 @@ 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 a zone on the real-master. +hiddenmasters = [] +# We use the vip for the cluster in case of HA +if node[:designate][:ha][:enabled] + hiddenmasters = [{ "host" => CrowbarPacemakerHelper.cluster_vip(node, "admin"), "port" => 5354 }] +else + hiddenmasters = node_search_with_cache("roles:designate-server").map do |n| + { "host" => Barclamp::Inventory.get_network_by_type(n, "admin").address, "port" => 5354 } + end +end # One could have multiple pools in designate. And # designate needs to have a default pool, this pools # id is hardcoded in the designate conf. By reusing that -# id we let designate know how crowbar's deployement of +# id we let designate know how crowbar's deployment of # dns servers looks like. # This pool id can be generated by in proposal, but this will change # with every delete/create cycle of proposal. This might mess @@ -41,11 +49,11 @@ "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 } }, + "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,