m3scluster / mesos-dns

DNS-based service discovery for Mesos.
https://m3scluster.github.io/mesos-dns/
Apache License 2.0
0 stars 0 forks source link

mesos-dns ip sorting for multi homed #1

Open f1-outsourcing opened 1 year ago

f1-outsourcing commented 1 year ago

Hi Andreas, how are you? ;)

I have something, but I am not sure if this is even interesting for you. I am using on mesos-dns on multiple networks 192.168.x.0, 192.168.y.0, 192.168.z.0. Not only because I try to be cheap on resources, but I also have 'resolvers' on such networks.

Problem that I have is that tasks on 192.168.z.0 are getting at random ip's of eg 192.168.z.0 and 192.168.y.0. Problem is of course when the task gets 192.168.y.0. Then routing fails.

named has a sorting solution for this.

       sortlist {
          192.168.y.0/24; {
             192.168.y.0/24;
             192.168.z.0/24;
             };
          192.168.z.0/24; {
             192.168.z.0/24;
             192.168.y.0/24;

Is it possible to adapt mesos-dns so it gives first all 192.168.z.0 to a request from a 192.168.z.0 network?

https://github.com/mesosphere/mesos-dns/issues/556 https://github.com/AVENTER-UG/mesos-dns

andreaspeters commented 1 year ago

Hi Marc,

I'm fine. How are you?

To your issue/idea. I think your idea make sense. I will have a look if I can add it.

f1-outsourcing commented 1 year ago

Hi Marc,

I'm fine. How are you?

So, so, everything is so slow here because of the ig/chatgpt job hopping generation, dreaming about g wagons, while they don't realise that currently every generation has less than the one before.

To your issue/idea. I think your idea make sense. I will have a look if I can add it.

Currently it is nicely cycling these ranges, printing the next element[1]. However I can't really think of a reason why one would not like this to be sorted by 'network', except for maybe other tasks that are on multiple networks (like haproxy). Maybe it is best to enable/disable this via the configuration file[2]

Somehow you need to track via what interface the dns request was received, get the ip/subnet from that interface. Then when cycling through the result test if an entry is within the interface address space, if so put it on 1st, 2nd, 3rd etc position[3]. This way the result should still be randomized.

[3]

192.168.123.63
192.168.123.65
192.168.123.64
192.168.124.55
192.168.124.56
192.168.124.57

[2]

  "dnsinterfacesorting": true
}

[1]

[@test ~]# dig +short server.test.marathon.mesos
192.168.123.63
192.168.124.55
192.168.123.65
192.168.124.56
192.168.123.64
192.168.124.57
[@test ~]# dig +short server.test.marathon.mesos
192.168.124.55
192.168.123.65
192.168.124.56
192.168.123.64
192.168.124.57
192.168.123.63
[@test ~]# dig +short server.test.marathon.mesos
192.168.123.65
192.168.124.56
192.168.123.64
192.168.124.57
192.168.123.63
192.168.124.55
[@test ~]# dig +short server.test.marathon.mesos
192.168.124.56
192.168.123.64
192.168.124.57
192.168.123.63
192.168.124.55
192.168.123.65
[@test ~]# dig +short server.test.marathon.mesos
192.168.123.64
192.168.124.57
192.168.123.63
192.168.124.55
192.168.123.65
192.168.124.56
[@test ~]# dig +short server.test.marathon.mesos
192.168.124.57
192.168.123.63
192.168.124.55
192.168.123.65
192.168.124.56
192.168.123.64