skynetservices / skydns1

DNS for skynet or any other service discovery
MIT License
528 stars 54 forks source link

Handle CNAME response pointing to skydns managed domain #90

Closed adieu closed 10 years ago

adieu commented 10 years ago

When one domain name like service.domain.com is set as CNAME to service.env.domain.local and domain.local is managed by skydns, we should query skydns for the A records for service.env.domain.local and return the proper result.

Currently, we don't check result coming back from forwarded dns requests so we could not use CNAME to point one domain name to a skydns managed domain name.

This patch is just a simple copy & paste from ServeDNS function to ServeDNSForward function, we may need to rewrite both of the functions to remove the duplicate code.

miekg commented 10 years ago

Why doesn't your recusrive DNS server handle this case? I.e. why does need to be in the forwarder?

adieu commented 10 years ago

Let me explain it a little bit.

We have some internal services running in a docker based server. Skydns is used to track the ip address of these services. The service.env.domain.local kind of domain is quite long so we wanted alias like service.domain.com which is easier for users to remember.

Since skydns is not exposed to the internet, we forward requests to 8.8.8.8 and can't get correct ip from the response.

We might be able fix this by setting up a recursive dns server internally to handle it but it's easier to fix it in skydns and avoid another dns server.

I think alias is a nice to have feature. We could deploy a new version of service and change the alias to the new one to achieve smooth upgrade. And when people use skydns internally, or when they have split dns setup for internal and external, have built-in CNAME response processing should be very helpful.

miekg commented 10 years ago

Yes, you should have a local recursor for this. "Fixing" this is SkyDNS is not the correct solution.

adieu commented 10 years ago

OK. Let's leave it here so other people might be interested in it :)