plugin/kubernetes: Fix reverse TTL response (#1240)
Remove most 303 TTLs (those get skipped by the test) and use 5, which is the default for all tests.
This commit is contained in:
parent
621dd36f6d
commit
70a5a098c1
3 changed files with 29 additions and 29 deletions
|
@ -26,22 +26,22 @@ func (k *Kubernetes) Reverse(state request.Request, exact bool, opt plugin.Optio
|
|||
func (k *Kubernetes) serviceRecordForIP(ip, name string) []msg.Service {
|
||||
// First check services with cluster ips
|
||||
for _, service := range k.APIConn.SvcIndexReverse(ip) {
|
||||
if (len(k.Namespaces) > 0) && !k.namespaceExposed(service.Namespace) {
|
||||
if len(k.Namespaces) > 0 && !k.namespaceExposed(service.Namespace) {
|
||||
continue
|
||||
}
|
||||
domain := strings.Join([]string{service.Name, service.Namespace, Svc, k.primaryZone()}, ".")
|
||||
return []msg.Service{{Host: domain}}
|
||||
return []msg.Service{{Host: domain, TTL: k.ttl}}
|
||||
}
|
||||
// If no cluster ips match, search endpoints
|
||||
for _, ep := range k.APIConn.EpIndexReverse(ip) {
|
||||
if (len(k.Namespaces) > 0) && !k.namespaceExposed(ep.ObjectMeta.Namespace) {
|
||||
if len(k.Namespaces) > 0 && !k.namespaceExposed(ep.ObjectMeta.Namespace) {
|
||||
continue
|
||||
}
|
||||
for _, eps := range ep.Subsets {
|
||||
for _, addr := range eps.Addresses {
|
||||
if addr.IP == ip {
|
||||
domain := strings.Join([]string{endpointHostname(addr, k.endpointNameMode), ep.ObjectMeta.Name, ep.ObjectMeta.Namespace, Svc, k.primaryZone()}, ".")
|
||||
return []msg.Service{{Host: domain}}
|
||||
return []msg.Service{{Host: domain, TTL: k.ttl}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue