Ignore duplicate DNS in case of external nameservers

Hi,

Currently I am working with Foreman 1.16 and Katello 3.5. Discovery plugin enabled, DNS & DHCP proxies are not.
The environment I’d like to use it for is currently around 300 physical nodes and 20ish VM’s.

All hosts have at least 2 networks (one internal and one public) which also can give some problems as foreman is not really able to cope with multiple networks (e.g. some hosts need a different global pxe entry for the discovery host as others do).

The environment has it’s own DNS servers which we ourselves do administer but we do not want foreman to be the boss of this DNS as we use another tool to generate all entries.
The problem I currently encounter is that foreman does a DNS check when you want to add a node. This will fore sure give an error (and does so) as the DNS entries are already there.

Is there a way to kill of this behaviour and let foreman assume that duplicates are no problem at all?

Cheers,
Maarten

You cannot turn off this validation if DNS Proxy is set. You can, however, unassociate DNS smart proxy for given Domain. And Foreman should not do the validation, but looking in the codebase it looks like we do it always. This patch should do it, if you confirm feel free to submit RFE issue and PR and I will happily merge (if a test is added :slight_smile:

 diff --git a/app/models/concerns/orchestration/dns.rb b/app/models/concerns/orchestration/dns.rb
index eb5f37747..3de6fd90d 100644
--- a/app/models/concerns/orchestration/dns.rb
+++ b/app/models/concerns/orchestration/dns.rb
@@ -105,6 +105,8 @@ module Orchestration::DNS
     return false unless require_ip4_validation? || require_ip6_validation?
     # we should only alert on conflicts if overwrite mode is off
     return false if overwrite?
+    # do not validate when dns is not enabled for at least one of them
+    return false unless dns? && dns6?
 
     status = true
     DnsInterface::RECORD_TYPES.each do |record_type|

I fully support the foreman not checking it and leaving it up to the proxy to figure it out. This is a big source of issues if you don’t have a global DNS. There should at least be a setting for this but no validation if a DNS proxy is set sounds like an even better option.

This seems to do the trick for this specific issue. I do have to agree with ekohl that this should be configurable anyway. There are enough situations to think of where a duplicate might exists (e.g. a node which must have a different DNS name internally from the external DNS)

So instead of having this very specific issue fixed I’d like to see a config option for this.

Do you want to try the patch? It’s in the very same file, creating new provisioning option is not difficult too, just one line. We will need a unit test tho. In any case, file a detailed RFE issue please.

Of course I’d like to try :wink:

I have created an RFE here: RFE: Change DNS duplicate checking to be an option
Not sure if I meet guidelines on RFE’s so if this doesn’t meet guidelines/requirements on RFE’s please let me know and I’ll fix the RFE

Cheers!

1 Like