Hi Conrad, Thanks for the patch :-) If such a feature is useful for someone, we could extend the geoip module. I think it would be better than creating another module with similar functionality.
Best, Daniel On 2/18/19 6:18 PM, Conrad Hoffmann wrote: > Hi there! > > At work, we make use something often referred to as "weighted records", > a feature offered by many managed DNS vendors. We use it to implement > e.g. a canary environment, where we test changes on a small portion of > production traffic. > > I played around with knot-dns for a bit (quite impressed), and figured > it might be nice to implement such a feature for it. Turns out, the code > is so amazing that if you abuse the infrastructure of the geoip module, > it only takes an hour (very impressed). > > If you are interested in trying it, read on further below, but just to > state my intention: I was wondering if such a feature would be of > interest at all? > > I realize the geoip module may not be the appropriate for such an > implementation, consider this merely a demo of sorts. > > So here goes nothing: > > 1. apply attached patch > 2. config file snippet: > > mod-geoip: > - id: test > config-file: /etc/knot/test.conf > ttl: 600 > mode: weighted > > zone: > - domain: example.com. > file: "/var/lib/knot/example.com.zone" > module: mod-geoip/test > > 3. /etc/knot/test.conf: > > lb.example.com: > - weight: 10 > CNAME: www1.example.com. > - weight: 5 > CNAME: www2.example.com. > > Results in this: > > conrad@deltree ~/hack/knot-dns $ for i in $(seq 1 100); do dig > @192.168.1.242 A lb.example.com +short; done | sort | uniq -c > 68 www1.example.com. > 32 www2.example.com. > conrad@deltree ~/hack/knot-dns $ for i in $(seq 1 100); do dig > @192.168.1.242 A lb.example.com +short; done | sort | uniq -c > 72 www1.example.com. > 28 www2.example.com. > conrad@deltree ~/hack/knot-dns $ for i in $(seq 1 100); do dig > @192.168.1.242 A lb.example.com +short; done | sort | uniq -c > 66 www1.example.com. > 34 www2.example.com. > > > You get the idea. Anyways, any thoughts and feedback would be greatly > appreciated. > > Thanks a lot, > Conrad > > -- https://lists.nic.cz/cgi-bin/mailman/listinfo/knot-dns-users
