plugin/k8s: fix endpoint index creation (#1222)

This commit is contained in:
Chris O'Haver
2017-11-10 15:38:45 -05:00
committed by GitHub
parent a78f46fb28
commit 9b8ee1c119

View File

@@ -145,11 +145,17 @@ func epNameNamespaceIndexFunc(obj interface{}) ([]string, error) {
}
func epIPIndexFunc(obj interface{}) ([]string, error) {
ep, ok := obj.(*api.EndpointAddress)
ep, ok := obj.(*api.Endpoints)
if !ok {
return nil, errors.New("obj was not an *api.EndpointAddress")
return nil, errors.New("obj was not an *api.Endpoints")
}
return []string{ep.IP}, nil
var idx []string
for _, eps := range ep.Subsets {
for _, addr := range eps.Addresses {
idx = append(idx, addr.IP)
}
}
return idx, nil
}
func serviceListFunc(c *kubernetes.Clientset, ns string, s *labels.Selector) func(meta.ListOptions) (runtime.Object, error) {