mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
plugin/k8s: fix endpoint index creation (#1222)
This commit is contained in:
@@ -145,11 +145,17 @@ func epNameNamespaceIndexFunc(obj interface{}) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func epIPIndexFunc(obj interface{}) ([]string, error) {
|
func epIPIndexFunc(obj interface{}) ([]string, error) {
|
||||||
ep, ok := obj.(*api.EndpointAddress)
|
ep, ok := obj.(*api.Endpoints)
|
||||||
if !ok {
|
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) {
|
func serviceListFunc(c *kubernetes.Clientset, ns string, s *labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user