aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/handler.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2022-02-22 09:38:57 -0500
committerGravatar GitHub <noreply@github.com> 2022-02-22 09:38:57 -0500
commit66dc74caebd4f4bdb8bd38d03b52611488424594 (patch)
tree41c8e56a785c45c138776b5d0d622507dd1726b6 /plugin/kubernetes/handler.go
parentd3a118e1c175eb00a0c171c2d2616dbaf39cdbba (diff)
downloadcoredns-66dc74caebd4f4bdb8bd38d03b52611488424594.tar.gz
coredns-66dc74caebd4f4bdb8bd38d03b52611488424594.tar.zst
coredns-66dc74caebd4f4bdb8bd38d03b52611488424594.zip
plugin/etcd+kubernetes: Persist truncated state to client if CNAME lookup response is truncated (#4715)
Persist the TC bit to client response for truncated CNAME lookups. Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/kubernetes/handler.go')
-rw-r--r--plugin/kubernetes/handler.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugin/kubernetes/handler.go b/plugin/kubernetes/handler.go
index 336fd08db..d673a7a40 100644
--- a/plugin/kubernetes/handler.go
+++ b/plugin/kubernetes/handler.go
@@ -22,18 +22,19 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
state.Zone = zone
var (
- records []dns.RR
- extra []dns.RR
- err error
+ records []dns.RR
+ extra []dns.RR
+ truncated bool
+ err error
)
switch state.QType() {
case dns.TypeA:
- records, err = plugin.A(ctx, &k, zone, state, nil, plugin.Options{})
+ records, truncated, err = plugin.A(ctx, &k, zone, state, nil, plugin.Options{})
case dns.TypeAAAA:
- records, err = plugin.AAAA(ctx, &k, zone, state, nil, plugin.Options{})
+ records, truncated, err = plugin.AAAA(ctx, &k, zone, state, nil, plugin.Options{})
case dns.TypeTXT:
- records, err = plugin.TXT(ctx, &k, zone, state, nil, plugin.Options{})
+ records, truncated, err = plugin.TXT(ctx, &k, zone, state, nil, plugin.Options{})
case dns.TypeCNAME:
records, err = plugin.CNAME(ctx, &k, zone, state, plugin.Options{})
case dns.TypePTR:
@@ -58,7 +59,7 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
// Do a fake A lookup, so we can distinguish between NODATA and NXDOMAIN
fake := state.NewWithQuestion(state.QName(), dns.TypeA)
fake.Zone = state.Zone
- _, err = plugin.A(ctx, &k, zone, fake, nil, plugin.Options{})
+ _, _, err = plugin.A(ctx, &k, zone, fake, nil, plugin.Options{})
}
if k.IsNameError(err) {
@@ -81,6 +82,7 @@ func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.M
m := new(dns.Msg)
m.SetReply(r)
+ m.Truncated = truncated
m.Authoritative = true
m.Answer = append(m.Answer, records...)
m.Extra = append(m.Extra, extra...)