diff options
author | 2017-11-10 15:38:45 -0500 | |
---|---|---|
committer | 2017-11-10 15:38:45 -0500 | |
commit | 9b8ee1c119c8dc2ad3304cffb084e78837716bdb (patch) | |
tree | e922debd0d79720654523322e6cc3e27547d3604 | |
parent | a78f46fb28aa4a8c533f40b7bd808b09572f7e66 (diff) | |
download | coredns-9b8ee1c119c8dc2ad3304cffb084e78837716bdb.tar.gz coredns-9b8ee1c119c8dc2ad3304cffb084e78837716bdb.tar.zst coredns-9b8ee1c119c8dc2ad3304cffb084e78837716bdb.zip |
plugin/k8s: fix endpoint index creation (#1222)
-rw-r--r-- | plugin/kubernetes/controller.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugin/kubernetes/controller.go b/plugin/kubernetes/controller.go index 3cad9e6c2..89b608703 100644 --- a/plugin/kubernetes/controller.go +++ b/plugin/kubernetes/controller.go @@ -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) { |