aboutsummaryrefslogtreecommitdiff
path: root/middleware/kubernetes/autopath.go
blob: 3d677e4dfc0f82064a3ca4fd8c94b59356382f2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package kubernetes

import "k8s.io/client-go/1.5/pkg/api"

// TODO(miek): rename and put in autopath.go file. This will be for the
// external middleware autopath to use. Mostly to get the namespace:
//name, path, ok := autopath.SplitSearch(zone, state.QName(), p.Namespace)
func (k *Kubernetes) findPodWithIP(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
	}
	return nil
}