Support timeout in watch requests

This commit is contained in:
Wojciech Tyczynski
2015-10-16 15:07:14 +02:00
parent 40b6f1cc28
commit f4d75e0a0a
85 changed files with 256 additions and 160 deletions

View File

@@ -103,7 +103,8 @@ func NewLimitRanger(client client.Interface, limitFunc LimitFunc) admission.Inte
return client.LimitRanges(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return client.LimitRanges(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return client.LimitRanges(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
},
}
indexer, reflector := cache.NewNamespaceKeyedIndexerAndReflector(lw, &api.LimitRange{}, 0)

View File

@@ -88,7 +88,8 @@ func NewProvision(c client.Interface) admission.Interface {
return c.Namespaces().List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), options)
},
},
&api.Namespace{},

View File

@@ -95,7 +95,8 @@ func NewExists(c client.Interface) admission.Interface {
return c.Namespaces().List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), options)
},
},
&api.Namespace{},

View File

@@ -112,7 +112,8 @@ func NewLifecycle(c client.Interface) admission.Interface {
return c.Namespaces().List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return c.Namespaces().Watch(labels.Everything(), fields.Everything(), options)
},
},
&api.Namespace{},

View File

@@ -54,7 +54,8 @@ func NewResourceQuota(client client.Interface) admission.Interface {
return client.ResourceQuotas(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return client.ResourceQuotas(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return client.ResourceQuotas(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
},
}
indexer, reflector := cache.NewNamespaceKeyedIndexerAndReflector(lw, &api.ResourceQuota{}, 0)

View File

@@ -86,7 +86,8 @@ func NewServiceAccount(cl client.Interface) *serviceAccount {
return cl.ServiceAccounts(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return cl.ServiceAccounts(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return cl.ServiceAccounts(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
},
},
&api.ServiceAccount{},
@@ -100,7 +101,8 @@ func NewServiceAccount(cl client.Interface) *serviceAccount {
return cl.Secrets(api.NamespaceAll).List(labels.Everything(), tokenSelector)
},
WatchFunc: func(resourceVersion string) (watch.Interface, error) {
return cl.Secrets(api.NamespaceAll).Watch(labels.Everything(), tokenSelector, resourceVersion)
options := api.ListOptions{ResourceVersion: resourceVersion}
return cl.Secrets(api.NamespaceAll).Watch(labels.Everything(), tokenSelector, options)
},
},
&api.Secret{},