mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
Add k8s external service CNAMEs (#677)
* Add external service cnames * remove cruft * update CI k8s version * change CI k8s version * min k8s ver for ext services * trying k8s 1.5 * k8s 1.5 requires ports spec * remove kruft * update dns schema version
This commit is contained in:
committed by
Miek Gieben
parent
2f2c90f391
commit
d917ff5ac2
@@ -25,7 +25,7 @@ func A(b ServiceBackend, zone string, state request.Request, previousRecords []d
|
||||
what, ip := serv.HostType()
|
||||
|
||||
switch what {
|
||||
case dns.TypeANY:
|
||||
case dns.TypeCNAME:
|
||||
if Name(state.Name()).Matches(dns.Fqdn(serv.Host)) {
|
||||
// x CNAME x is a direct loop, don't add those
|
||||
continue
|
||||
@@ -92,7 +92,7 @@ func AAAA(b ServiceBackend, zone string, state request.Request, previousRecords
|
||||
what, ip := serv.HostType()
|
||||
|
||||
switch what {
|
||||
case dns.TypeANY:
|
||||
case dns.TypeCNAME:
|
||||
// Try to resolve as CNAME if it's not an IP, but only if we don't create loops.
|
||||
if Name(state.Name()).Matches(dns.Fqdn(serv.Host)) {
|
||||
// x CNAME x is a direct loop, don't add those
|
||||
@@ -182,7 +182,7 @@ func SRV(b ServiceBackend, zone string, state request.Request, opt Options) (rec
|
||||
what, ip := serv.HostType()
|
||||
|
||||
switch what {
|
||||
case dns.TypeANY:
|
||||
case dns.TypeCNAME:
|
||||
srv := serv.NewSRV(state.QName(), weight)
|
||||
records = append(records, srv)
|
||||
|
||||
@@ -250,7 +250,7 @@ func MX(b ServiceBackend, zone string, state request.Request, opt Options) (reco
|
||||
}
|
||||
what, ip := serv.HostType()
|
||||
switch what {
|
||||
case dns.TypeANY:
|
||||
case dns.TypeCNAME:
|
||||
mx := serv.NewMX(state.QName())
|
||||
records = append(records, mx)
|
||||
if _, ok := lookup[mx.Mx]; ok {
|
||||
@@ -364,7 +364,7 @@ func NS(b ServiceBackend, zone string, state request.Request, opt Options) (reco
|
||||
for _, serv := range services {
|
||||
what, ip := serv.HostType()
|
||||
switch what {
|
||||
case dns.TypeANY:
|
||||
case dns.TypeCNAME:
|
||||
return nil, nil, debug, fmt.Errorf("NS record must be an IP address: %s", serv.Host)
|
||||
|
||||
case dns.TypeA, dns.TypeAAAA:
|
||||
|
||||
Reference in New Issue
Block a user