mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
plugin/kubernetes: set TTL on pod responses (#1239)
The TTL was still zero, instead it should adhere to the k.ttl setting. Change this and update tests to match.
This commit is contained in:
@@ -320,7 +320,7 @@ func (k *Kubernetes) findPods(r recordRequest, zone string) (pods []msg.Service,
|
||||
}
|
||||
|
||||
if k.podMode == podModeInsecure {
|
||||
return []msg.Service{{Key: strings.Join([]string{zonePath, Pod, namespace, podname}, "/"), Host: ip}}, nil
|
||||
return []msg.Service{{Key: strings.Join([]string{zonePath, Pod, namespace, podname}, "/"), Host: ip, TTL: k.ttl}}, nil
|
||||
}
|
||||
|
||||
// PodModeVerified
|
||||
@@ -331,7 +331,7 @@ func (k *Kubernetes) findPods(r recordRequest, zone string) (pods []msg.Service,
|
||||
}
|
||||
// check for matching ip and namespace
|
||||
if ip == p.Status.PodIP && match(namespace, p.Namespace) {
|
||||
s := msg.Service{Key: strings.Join([]string{zonePath, Pod, namespace, podname}, "/"), Host: ip}
|
||||
s := msg.Service{Key: strings.Join([]string{zonePath, Pod, namespace, podname}, "/"), Host: ip, TTL: k.ttl}
|
||||
pods = append(pods, s)
|
||||
|
||||
err = nil
|
||||
|
||||
Reference in New Issue
Block a user