eBayClassifiedsGroup / PanteraS

PanteraS - PaaS - Platform as a Service in a box
GNU General Public License v2.0
199 stars 61 forks source link

DNS resolution to unknown service returns current host #224

Closed elan100cs closed 8 years ago

elan100cs commented 8 years ago

Hello,

First of all thanks for this awesome project. This is more a question rather than an issue.
I have notice that when we try to ping an arbitrary service which doesnt exist the host returns it's current machine IP. E.g.

ping randomservice.service.consul

Will return the current HOST IP.

Upon inspecting the source code, this is because of the DNSMASQ are set to resolve any address ending with CONSUL to the current CONSUL_IP. See generate_yml.sh

# Disable dnsmasq address re-mapping on non slaves - no HAProxy there
[ "${SLAVE}" == "false" ] && DNSMASQ_ADDRESS=${DNSMASQ_ADDRESS:-' '}
# dnsmaq cannot be set to listen on 0.0.0.0 - it causes lot of issues
# and by default it works on all addresses
DNSMASQ_ADDRESS=${DNSMASQ_ADDRESS:-"--address=/consul/${CONSUL_IP}"}

From the dnsmasq man:

-A, --address=//[domain/][] Specify an IP address to return for any host in the given domains. Queries in the domains are never forwarded and always replied to with the specified IP address which may be IPv4 or IPv6. To give both IPv4 and IPv6 addresses for a domain, use repeated -A flags.

Is this behaviour intended? If i dont want this behaviour by removing the lines from generate_yml.sh there, do you see any other impact caused by removing the above code?

sielaq commented 8 years ago

Yes indeed, this is intended, since Fabio(or HAproxy+iptables) is already listening on port 80 on every slave, and will redirect you to a proper instance anyway - so it doesn't matter which slave you hit even if the service doesn't run locally.

You can also modify dnsmasq behavior (you can overwrite any ENV variables just just run export DNSMASQ_ADDRESS=" " ; ./generate_yml.sh) or disable it and use your own DNS, it is still gonna work, but you will just experience a bit more network traffic, that's all.

elan100cs commented 8 years ago

Thanks for this, we will do as you suggested export DNSMASQ_ADDRESS=" " ; ./generate_yml.sh

since we dont want non existing service to resolve to any host ip.