Kubernetes: cleanup channel handling

Only use one channel for all watches
Re-use stop channel from the provider
Skip events that have already been handled by the provider, builds on 007f8cc48ea9504bb7754c5e3244124be422f47d
This commit is contained in:
Yves Peter 2016-12-03 21:20:39 +01:00
parent 87eac1dc1a
commit fc788eb426
3 changed files with 20 additions and 40 deletions

View file

@ -1277,10 +1277,6 @@ func (c clientMock) GetIngresses(namespaces k8s.Namespaces) []*v1beta1.Ingress {
return result
}
func (c clientMock) WatchIngresses(labelSelector string, stopCh <-chan struct{}) chan interface{} {
return c.watchChan
}
func (c clientMock) GetService(namespace, name string) (*v1.Service, bool, error) {
for _, service := range c.services {
if service.Namespace == namespace && service.Name == name {
@ -1299,6 +1295,6 @@ func (c clientMock) GetEndpoints(namespace, name string) (*v1.Endpoints, bool, e
return &v1.Endpoints{}, true, nil
}
func (c clientMock) WatchAll(labelString string, stopCh <-chan bool) (chan interface{}, error) {
func (c clientMock) WatchAll(labelString string, stopCh <-chan struct{}) (<-chan interface{}, error) {
return c.watchChan, nil
}