support for zone transfer for kubernetes (#1259)

* plugin/kubernetes: axfr

Hook up dynamic SOA serial by setting ResourceEventHandlerFuncs in
dnsController.

Add prototype of returns msg.Services via the Transfer function. Leave
expanding this to RRs out of scope for a bit.

* plugin/kubernetes: axfr

Respond to AXFR queries

* Fixing race condition

* Fixing instantiation of dnstest writer

* Updates from review
This commit is contained in:
Brad Beam 2018-02-08 10:11:04 -06:00 committed by Miek Gieben
parent 864f502356
commit 6fd954f19c
13 changed files with 383 additions and 18 deletions

View file

@ -53,6 +53,8 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
break
}
fallthrough
case dns.TypeAXFR, dns.TypeIXFR:
k.Transfer(ctx, state)
default:
// Do a fake A lookup, so we can distinguish between NODATA and NXDOMAIN
_, err = plugin.A(&k, zone, state, nil, plugin.Options{})
@ -76,6 +78,7 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
m.Extra = append(m.Extra, extra...)
m = dnsutil.Dedup(m)
state.SizeAndDo(m)
m, _ = state.Scrub(m)
w.WriteMsg(m)