mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Merge pull request #18080 from wojtek-t/list_options_in_listwatch
Pass ListOptions to List in ListWatch.
This commit is contained in:
@@ -96,8 +96,8 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
// Manage addition/update of daemon sets.
|
||||
dsc.dsStore.Store, dsc.dsController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).Watch(options)
|
||||
@@ -128,8 +128,8 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
// more pods until all the effects (expectations) of a daemon set's create/delete have been observed.
|
||||
dsc.podStore.Store, dsc.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
@@ -146,8 +146,8 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
// Watch for new nodes or updates to nodes - daemon pods are launched on new nodes, and possibly when labels on nodes change,
|
||||
dsc.nodeStore.Store, dsc.nodeController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return dsc.kubeClient.Nodes().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return dsc.kubeClient.Nodes().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Nodes().Watch(options)
|
||||
|
||||
@@ -62,8 +62,8 @@ func NewEndpointController(client *client.Client, resyncPeriod controller.Resync
|
||||
|
||||
e.serviceStore.Store, e.serviceController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return e.client.Services(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return e.client.Services(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Services(api.NamespaceAll).Watch(options)
|
||||
@@ -83,8 +83,8 @@ func NewEndpointController(client *client.Client, resyncPeriod controller.Resync
|
||||
|
||||
e.podStore.Store, e.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return e.client.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return e.client.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Pods(api.NamespaceAll).Watch(options)
|
||||
|
||||
@@ -122,7 +122,7 @@ func (f *FakeControllerSource) Change(e watch.Event, watchProbability float64) {
|
||||
}
|
||||
|
||||
// List returns a list object, with its resource version set.
|
||||
func (f *FakeControllerSource) List() (runtime.Object, error) {
|
||||
func (f *FakeControllerSource) List(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
f.lock.RLock()
|
||||
defer f.lock.RUnlock()
|
||||
list := make([]runtime.Object, 0, len(f.items))
|
||||
|
||||
@@ -71,7 +71,7 @@ func TestRCNumber(t *testing.T) {
|
||||
}
|
||||
go consume(t, w, []string{"2", "3"}, wg)
|
||||
|
||||
list, err := source.List()
|
||||
list, err := source.List(unversioned.ListOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ func New(kubeClient client.Interface, resyncPeriod controller.ResyncPeriodFunc,
|
||||
|
||||
gcc.podStore.Store, gcc.podStoreSyncer = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
options := unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{terminatedSelector}}
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
options.FieldSelector.Selector = terminatedSelector
|
||||
return gcc.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
|
||||
@@ -83,8 +83,8 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
|
||||
|
||||
jm.jobStore.Store, jm.jobController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).Watch(options)
|
||||
@@ -106,8 +106,8 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
|
||||
|
||||
jm.podStore.Store, jm.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
|
||||
@@ -45,8 +45,8 @@ func NewNamespaceController(kubeClient client.Interface, versions *unversioned.A
|
||||
var controller *framework.Controller
|
||||
_, controller = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return kubeClient.Namespaces().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return kubeClient.Namespaces().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.Namespaces().Watch(options)
|
||||
|
||||
@@ -162,8 +162,8 @@ func NewNodeController(
|
||||
|
||||
nc.podStore.Store, nc.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
@@ -178,8 +178,8 @@ func NewNodeController(
|
||||
)
|
||||
nc.nodeStore.Store, nc.nodeController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return nc.kubeClient.Nodes().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return nc.kubeClient.Nodes().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return nc.kubeClient.Nodes().Watch(options)
|
||||
|
||||
@@ -55,8 +55,8 @@ func NewPersistentVolumeClaimBinder(kubeClient client.Interface, syncPeriod time
|
||||
|
||||
_, volumeController := framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumes().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumes().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumes().Watch(options)
|
||||
@@ -73,8 +73,8 @@ func NewPersistentVolumeClaimBinder(kubeClient client.Interface, syncPeriod time
|
||||
)
|
||||
_, claimController := framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).Watch(options)
|
||||
|
||||
@@ -62,8 +62,8 @@ func NewPersistentVolumeRecycler(kubeClient client.Interface, syncPeriod time.Du
|
||||
|
||||
_, volumeController := framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumes().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return kubeClient.PersistentVolumes().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumes().Watch(options)
|
||||
|
||||
@@ -107,8 +107,8 @@ func NewReplicationManager(kubeClient client.Interface, resyncPeriod controller.
|
||||
|
||||
rm.rcStore.Store, rm.rcController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).Watch(options)
|
||||
@@ -148,8 +148,8 @@ func NewReplicationManager(kubeClient client.Interface, resyncPeriod controller.
|
||||
|
||||
rm.podStore.Store, rm.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
|
||||
@@ -65,8 +65,8 @@ func NewResourceQuotaController(kubeClient client.Interface, resyncPeriod contro
|
||||
|
||||
rq.rqIndexer, rq.rqController = framework.NewIndexerInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return rq.kubeClient.ResourceQuotas(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return rq.kubeClient.ResourceQuotas(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rq.kubeClient.ResourceQuotas(api.NamespaceAll).Watch(options)
|
||||
@@ -105,8 +105,8 @@ func NewResourceQuotaController(kubeClient client.Interface, resyncPeriod contro
|
||||
// release compute resources from any associated quota.
|
||||
rq.podStore.Store, rq.podController = framework.NewInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return rq.kubeClient.Pods(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return rq.kubeClient.Pods(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rq.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
|
||||
@@ -80,8 +80,8 @@ func NewServiceAccountsController(cl client.Interface, options ServiceAccountsCo
|
||||
}
|
||||
e.serviceAccounts, e.serviceAccountController = framework.NewIndexerInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
options := unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{accountSelector}}
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
options.FieldSelector.Selector = accountSelector
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
@@ -99,8 +99,8 @@ func NewServiceAccountsController(cl client.Interface, options ServiceAccountsCo
|
||||
|
||||
e.namespaces, e.namespaceController = framework.NewIndexerInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return e.client.Namespaces().List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return e.client.Namespaces().List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Namespaces().Watch(options)
|
||||
|
||||
@@ -62,8 +62,8 @@ func NewTokensController(cl client.Interface, options TokensControllerOptions) *
|
||||
|
||||
e.serviceAccounts, e.serviceAccountController = framework.NewIndexerInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).List(unversioned.ListOptions{})
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).Watch(options)
|
||||
@@ -82,8 +82,8 @@ func NewTokensController(cl client.Interface, options TokensControllerOptions) *
|
||||
tokenSelector := fields.SelectorFromSet(map[string]string{client.SecretType: string(api.SecretTypeServiceAccountToken)})
|
||||
e.secrets, e.secretController = framework.NewIndexerInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func() (runtime.Object, error) {
|
||||
options := unversioned.ListOptions{FieldSelector: unversioned.FieldSelector{tokenSelector}}
|
||||
ListFunc: func(options unversioned.ListOptions) (runtime.Object, error) {
|
||||
options.FieldSelector.Selector = tokenSelector
|
||||
return e.client.Secrets(api.NamespaceAll).List(options)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
|
||||
Reference in New Issue
Block a user