Merge pull request #1652 from aledbf/cleanup

Remove node lister
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-11-05 21:20:46 -03:00 committed by GitHub
commit 81dde562e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ type IngressLister struct {
cache.Store cache.Store
} }
// SecretsLister makes a Store that lists Secrets. // SecretLister makes a Store that lists Secrets.
type SecretLister struct { type SecretLister struct {
cache.Store cache.Store
} }
@ -79,24 +79,18 @@ func (sl *ServiceLister) GetByName(name string) (*apiv1.Service, error) {
return s.(*apiv1.Service), nil return s.(*apiv1.Service), nil
} }
// NodeLister makes a Store that lists Nodes.
type NodeLister struct {
cache.Store
}
// EndpointLister makes a Store that lists Endpoints. // EndpointLister makes a Store that lists Endpoints.
type EndpointLister struct { type EndpointLister struct {
cache.Store cache.Store
} }
// GetServiceEndpoints returns the endpoints of a service, matched on service name. // GetServiceEndpoints returns the endpoints of a service, matched on service name.
func (s *EndpointLister) GetServiceEndpoints(svc *apiv1.Service) (ep apiv1.Endpoints, err error) { func (s *EndpointLister) GetServiceEndpoints(svc *apiv1.Service) (*apiv1.Endpoints, error) {
for _, m := range s.Store.List() { for _, m := range s.Store.List() {
ep = *m.(*apiv1.Endpoints) ep := m.(*apiv1.Endpoints)
if svc.Name == ep.Name && svc.Namespace == ep.Namespace { if svc.Name == ep.Name && svc.Namespace == ep.Namespace {
return ep, nil return ep, nil
} }
} }
err = fmt.Errorf("could not find endpoints for service: %v", svc.Name) return nil, fmt.Errorf("could not find endpoints for service: %v", svc.Name)
return
} }