plugin/kubernetes: fix case preservation and add test (#2430)

* fix case preservation and add test
* only fix case in k8s
This commit is contained in:
Chris O'Haver 2019-01-08 08:30:03 -05:00 committed by GitHub
parent 418edd2a2f
commit 18f25dbef3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 4 deletions

View file

@ -18,11 +18,12 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
m.SetReply(r)
m.Authoritative = true
zone := plugin.Zones(k.Zones).Matches(state.Name())
qname := state.QName()
zone := plugin.Zones(k.Zones).Matches(qname)
if zone == "" {
return plugin.NextOrFailure(k.Name(), k.Next, ctx, w, r)
}
zone = qname[len(qname)-len(zone):] // maintain case of original query
state.Zone = zone
var (