Merge pull request #11679 from bprashanth/haproxy

Auto commit by PR queue bot
This commit is contained in:
Alex Mohr
2015-08-04 15:35:44 -07:00
11 changed files with 1137 additions and 1 deletions

View File

@@ -266,4 +266,27 @@ func (s *StoreToServiceLister) GetPodServices(pod *api.Pod) (services []api.Serv
return
}
// TODO: add StoreToEndpointsLister for use in kube-proxy.
// StoreToEndpointsLister makes a Store that lists endpoints.
type StoreToEndpointsLister struct {
Store
}
// List lists all endpoints in the store.
func (s *StoreToEndpointsLister) List() (services api.EndpointsList, err error) {
for _, m := range s.Store.List() {
services.Items = append(services.Items, *(m.(*api.Endpoints)))
}
return services, nil
}
// GetServiceEndpoints returns the endpoints of a service, matched on service name.
func (s *StoreToEndpointsLister) GetServiceEndpoints(svc *api.Service) (ep api.Endpoints, err error) {
for _, m := range s.Store.List() {
ep = *m.(*api.Endpoints)
if svc.Name == ep.Name && svc.Namespace == ep.Namespace {
return ep, nil
}
}
err = fmt.Errorf("Could not find endpoints for service: %v", svc.Name)
return
}