desginate: Add mdns as hidden master
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.
This change is not really required but only eases out the config from an admin perspective.
Also having multiple nameservers confuses designate in some times as according to these nameserver designate is not authoritative of these zones and recordsets.
This code change has no impact on any part of crowbar apart from changing the sample file. But helps greatly in trying to understand what this file really means.
╰─ irb
irb(main):001:0> dnsmaster='123.123.123.123'
=> "123.123.123.123"
irb(main):002:0> dns = {:fqdn => 'me.exmaple.com' }
=> {:fqdn=>"me.exmaple.com"}
irb(main):003:0> network_settings = {:mdns_bind_host => dnsmaster }
=> {:mdns_bind_host=>"123.123.123.123"}
irb(main):004:0> pools = [{
irb(main):005:2* "name" => "default-bind",
irb(main):006:2* "description" => "Sample Pool for designate (relies only 1 dns-master)",
irb(main):007:2* "id" => "794ccc2c-d751-44fe-b57f-8894c9f5c842",
irb(main):008:2* "attributes" => {},
irb(main):009:2* "ns_records" => [{ "hostname" => "#{dns[:fqdn]}.", "priority" => 1 }],
irb(main):010:2* "nameservers" => [{ "host" => dnsmaster, "port" => 53 }],
irb(main):011:2* "also_notifies" => [],
irb(main):012:2* "targets" => [{
irb(main):013:4* "type" => "bind9",
irb(main):014:4* "description" => "BIND9 Server 1",
irb(main):015:4* "masters" => [{ "host" => network_settings[:mdns_bind_host], "port" => 5354 }],
irb(main):016:4* "options" => {
irb(main):017:5* "host" => dnsmaster,
irb(main):018:5* "port" => 53,
irb(main):019:5* "rndc_host" => dnsmaster,
irb(main):020:5* "rndc_port" => 953,
irb(main):021:5* "rndc_key_file" => "/etc/designate/rndc.key"
irb(main):022:5> }
irb(main):023:4> }]
irb(main):024:2> }]
=> [{"name"=>"default-bind", "description"=>"Sample Pool for designate (relies only 1 dns-master)", "id"=>"794ccc2c-d751-44fe-b57f-8894c9f5c842", "attributes"=>{}, "ns_records"=>[{"hostname"=>"me.exmaple.com.", "priority"=>1}], "nameservers"=>[{"host"=>"123.123.123.123", "port"=>53}], "also_notifies"=>[], "targets"=>[{"type"=>"bind9", "description"=>"BIND9 Server 1", "masters"=>[{"host"=>"123.123.123.123", "port"=>5354}], "options"=>{"host"=>"123.123.123.123", "port"=>53, "rndc_host"=>"123.123.123.123", "rndc_port"=>953, "rndc_key_file"=>"/etc/designate/rndc.key"}}]}]
(failed reverse-i-search)`': import^C
irb(main):025:0> require 'yaml'
=> true
irb(main):026:0> pools.to_yaml
=> "---\n- name: default-bind\n description: Sample Pool for designate (relies only 1 dns-master)\n id: 794ccc2c-d751-44fe-b57f-8894c9f5c842\n attributes: {}\n ns_records:\n - hostname: me.exmaple.com.\n priority: 1\n nameservers:\n - host: 123.123.123.123\n port: 53\n also_notifies: []\n targets:\n - type: bind9\n description: BIND9 Server 1\n masters:\n - host: 123.123.123.123\n port: 5354\n options:\n host: 123.123.123.123\n port: 53\n rndc_host: 123.123.123.123\n rndc_port: 953\n rndc_key_file: \"/etc/designate/rndc.key\"\n"
this change is now needed for HA, I have added comments to the code and update the commit message to reflect why this change is required.
Rebased with HA fix
Addressing the open review comments in the next commit. Note, "nameservers" will be updated via SCRD-9636 to use public FQDNs.