plugin/k8s_external: Add support for PTR requests (#5435)
* Exclude External IP addresses from being added to the existing kubernetes' plugin IP->Service index * Add support for PTR requests on External IPs of Services to the k8s_external plugin Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
parent
d903a963ee
commit
e80d696502
12 changed files with 163 additions and 44 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"math"
|
||||
|
||||
"github.com/coredns/coredns/plugin/etcd/msg"
|
||||
"github.com/coredns/coredns/plugin/pkg/dnsutil"
|
||||
"github.com/coredns/coredns/request"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
|
@ -76,6 +77,19 @@ func (e *External) aaaa(ctx context.Context, services []msg.Service, state reque
|
|||
return records, truncated
|
||||
}
|
||||
|
||||
func (e *External) ptr(services []msg.Service, state request.Request) (records []dns.RR) {
|
||||
dup := make(map[string]struct{})
|
||||
for _, s := range services {
|
||||
if _, ok := dup[s.Host]; !ok {
|
||||
dup[s.Host] = struct{}{}
|
||||
rr := s.NewPTR(state.QName(), dnsutil.Join(s.Host, e.Zones[0]))
|
||||
rr.Hdr.Ttl = e.ttl
|
||||
records = append(records, rr)
|
||||
}
|
||||
}
|
||||
return records
|
||||
}
|
||||
|
||||
func (e *External) srv(ctx context.Context, services []msg.Service, state request.Request) (records, extra []dns.RR) {
|
||||
dup := make(map[item]struct{})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue