plugin/k8s: fix endpoint index creation
@@ -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")
+ }
+ var idx []string
+ for _, eps := range ep.Subsets {
+ for _, addr := range eps.Addresses {
+ idx = append(idx, addr.IP)
+ }
}
- return []string{ep.IP}, nil
+ return idx, nil
}
func serviceListFunc(c *kubernetes.Clientset, ns string, s *labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
