diff options
author | 2017-09-29 15:58:50 -0400 | |
---|---|---|
committer | 2017-09-29 15:58:50 -0400 | |
commit | 4b3a430ff2e6a39278eebd1493936c3a8a161fa0 (patch) | |
tree | a48c18346039c9b7808ec2395eeda49f8a0e1f0c /plugin/kubernetes/autopath.go | |
parent | 45b0252c1aa3c9afb1951d4185644e23805167e5 (diff) | |
download | coredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.tar.gz coredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.tar.zst coredns-4b3a430ff2e6a39278eebd1493936c3a8a161fa0.zip |
plugin/kubernetes: Enable protobuf, Update client api package (#1114)
* vendor
* code
Diffstat (limited to 'plugin/kubernetes/autopath.go')
-rw-r--r-- | plugin/kubernetes/autopath.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/plugin/kubernetes/autopath.go b/plugin/kubernetes/autopath.go index f758869f1..feab430a9 100644 --- a/plugin/kubernetes/autopath.go +++ b/plugin/kubernetes/autopath.go @@ -4,7 +4,7 @@ import ( "github.com/coredns/coredns/plugin" "github.com/coredns/coredns/request" - "k8s.io/client-go/1.5/pkg/api" + api "k8s.io/client-go/pkg/api/v1" ) // AutoPath implements the AutoPathFunc call from the autopath plugin. @@ -40,14 +40,10 @@ func (k *Kubernetes) AutoPath(state request.Request) []string { } // podWithIP return the api.Pod for source IP ip. It returns nil if nothing can be found. -func (k *Kubernetes) podWithIP(ip string) (p *api.Pod) { - objList := k.APIConn.PodIndex(ip) - for _, o := range objList { - p, ok := o.(*api.Pod) - if !ok { - return nil - } - return p +func (k *Kubernetes) podWithIP(ip string) *api.Pod { + ps := k.APIConn.PodIndex(ip) + if len(ps) == 0 { + return nil } - return nil + return ps[0] } |