aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/kubernetes.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-11-15 14:06:37 +0000
committerGravatar GitHub <noreply@github.com> 2017-11-15 14:06:37 +0000
commit621dd36f6d67a1be4549f6d70aa6e787326e274b (patch)
tree8bd2ee52a37cc93b1a6efa64564111e68fb83132 /plugin/kubernetes/kubernetes.go
parent99dd8f99f3f95e7000c5aac32701b2d0432b35bd (diff)
downloadcoredns-621dd36f6d67a1be4549f6d70aa6e787326e274b.tar.gz
coredns-621dd36f6d67a1be4549f6d70aa6e787326e274b.tar.zst
coredns-621dd36f6d67a1be4549f6d70aa6e787326e274b.zip
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.
Diffstat (limited to 'plugin/kubernetes/kubernetes.go')
-rw-r--r--plugin/kubernetes/kubernetes.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugin/kubernetes/kubernetes.go b/plugin/kubernetes/kubernetes.go
index 0168ab52a..d8b27d42d 100644
--- a/plugin/kubernetes/kubernetes.go
+++ b/plugin/kubernetes/kubernetes.go
@@ -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