mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	set ttl for ns records (#2452)
This commit is contained in:
		
				
					committed by
					
						 Miek Gieben
						Miek Gieben
					
				
			
			
				
	
			
			
			
						parent
						
							b0d37c5443
						
					
				
				
					commit
					278303ca0d
				
			| @@ -108,7 +108,7 @@ func (k *Kubernetes) Services(state request.Request, exact bool, opt plugin.Opti | ||||
| 	case dns.TypeNS: | ||||
| 		// We can only get here if the qname equals the zone, see ServeDNS in handler.go. | ||||
| 		ns := k.nsAddr() | ||||
| 		svc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), coredns)} | ||||
| 		svc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), coredns), TTL: k.ttl} | ||||
| 		return []msg.Service{svc}, nil | ||||
| 	} | ||||
|  | ||||
| @@ -116,7 +116,7 @@ func (k *Kubernetes) Services(state request.Request, exact bool, opt plugin.Opti | ||||
| 		// If this is an A request for "ns.dns", respond with a "fake" record for coredns. | ||||
| 		// SOA records always use this hardcoded name | ||||
| 		ns := k.nsAddr() | ||||
| 		svc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), coredns)} | ||||
| 		svc := msg.Service{Host: ns.A.String(), Key: msg.Path(state.QName(), coredns), TTL: k.ttl} | ||||
| 		return []msg.Service{svc}, nil | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -15,45 +15,45 @@ var kubeApexCases = []test.Case{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeSOA, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Answer: []dns.RR{ | ||||
| 			test.SOA("cluster.local.	303	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeHINFO, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.SOA("cluster.local.	303	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeNS, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Answer: []dns.RR{ | ||||
| 			test.NS("cluster.local. 303     IN      NS     ns.dns.cluster.local."), | ||||
| 			test.NS("cluster.local. 5     IN      NS     ns.dns.cluster.local."), | ||||
| 		}, | ||||
| 		Extra: []dns.RR{ | ||||
| 			test.A("ns.dns.cluster.local.   303       IN      A       127.0.0.1"), | ||||
| 			test.A("ns.dns.cluster.local.   5       IN      A       127.0.0.1"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeA, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.SOA("cluster.local.	303	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeAAAA, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.SOA("cluster.local.	303	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 		}, | ||||
| 	}, | ||||
| 	{ | ||||
| 		Qname: "cluster.local.", Qtype: dns.TypeSRV, | ||||
| 		Rcode: dns.RcodeSuccess, | ||||
| 		Ns: []dns.RR{ | ||||
| 			test.SOA("cluster.local.	303	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 			test.SOA("cluster.local.	5	IN	SOA	ns.dns.cluster.local. hostmaster.cluster.local. 1499347823 7200 1800 86400 5"), | ||||
| 		}, | ||||
| 	}, | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user