mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 15:13:08 +00:00
Support timeout in watch requests
This commit is contained in:
@@ -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)
|
||||
|
@@ -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{},
|
||||
|
@@ -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{},
|
||||
|
@@ -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{},
|
||||
|
@@ -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)
|
||||
|
@@ -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{},
|
||||
|
Reference in New Issue
Block a user