Merge pull request #573 from errm/fix-k8s-watch

Fix k8s watch
This commit is contained in:
Vincent Demeester 2016-08-16 09:32:50 +02:00 committed by GitHub
commit 498ce6b00c
2 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ static/
site/ site/
*.log *.log
*.exe *.exe
.DS_Store

View file

@ -111,9 +111,9 @@ func (c *clientImpl) GetService(name, namespace string) (Service, error) {
} }
// WatchServices returns all services in the cluster // WatchServices returns all services in the cluster
func (c *clientImpl) WatchServices(labelSelector string, stopCh <-chan bool) (chan interface{}, chan error, error) { func (c *clientImpl) WatchServices(stopCh <-chan bool) (chan interface{}, chan error, error) {
getURL := c.endpointURL + APIEndpoint + "/services" getURL := c.endpointURL + APIEndpoint + "/services"
return c.watch(getURL, labelSelector, stopCh) return c.watch(getURL, "", stopCh)
} }
// GetEndpoints returns the named Endpoints // GetEndpoints returns the named Endpoints
@ -134,9 +134,9 @@ func (c *clientImpl) GetEndpoints(name, namespace string) (Endpoints, error) {
} }
// WatchEndpoints returns endpoints in the cluster // WatchEndpoints returns endpoints in the cluster
func (c *clientImpl) WatchEndpoints(labelSelector string, stopCh <-chan bool) (chan interface{}, chan error, error) { func (c *clientImpl) WatchEndpoints(stopCh <-chan bool) (chan interface{}, chan error, error) {
getURL := c.endpointURL + APIEndpoint + "/endpoints" getURL := c.endpointURL + APIEndpoint + "/endpoints"
return c.watch(getURL, labelSelector, stopCh) return c.watch(getURL, "", stopCh)
} }
// WatchAll returns events in the cluster // WatchAll returns events in the cluster
@ -150,12 +150,12 @@ func (c *clientImpl) WatchAll(labelSelector string, stopCh <-chan bool) (chan in
return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err) return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err)
} }
stopServices := make(chan bool) stopServices := make(chan bool)
chanServices, chanServicesErr, err := c.WatchServices(labelSelector, stopServices) chanServices, chanServicesErr, err := c.WatchServices(stopServices)
if err != nil { if err != nil {
return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err) return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err)
} }
stopEndpoints := make(chan bool) stopEndpoints := make(chan bool)
chanEndpoints, chanEndpointsErr, err := c.WatchEndpoints(labelSelector, stopEndpoints) chanEndpoints, chanEndpointsErr, err := c.WatchEndpoints(stopEndpoints)
if err != nil { if err != nil {
return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err) return watchCh, errCh, fmt.Errorf("failed to create watch: %v", err)
} }