mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Simplify Watch() signature in clients.
This commit is contained in:
@@ -101,7 +101,7 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return dsc.kubeClient.Extensions().DaemonSets(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&extensions.DaemonSet{},
|
||||
@@ -133,7 +133,7 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return dsc.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
@@ -151,7 +151,7 @@ func NewDaemonSetsController(kubeClient client.Interface, resyncPeriod controlle
|
||||
return dsc.kubeClient.Nodes().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return dsc.kubeClient.Nodes().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return dsc.kubeClient.Nodes().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Node{},
|
||||
|
||||
@@ -67,7 +67,7 @@ func NewEndpointController(client *client.Client, resyncPeriod controller.Resync
|
||||
return e.client.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Services(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return e.client.Services(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Service{},
|
||||
@@ -88,7 +88,7 @@ func NewEndpointController(client *client.Client, resyncPeriod controller.Resync
|
||||
return e.client.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Pods(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return e.client.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
|
||||
@@ -70,7 +70,8 @@ func New(kubeClient client.Interface, resyncPeriod controller.ResyncPeriodFunc,
|
||||
return gcc.kubeClient.Pods(api.NamespaceAll).List(labels.Everything(), terminatedSelector)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return gcc.kubeClient.Pods(api.NamespaceAll).Watch(labels.Everything(), terminatedSelector, options)
|
||||
options.FieldSelector.Selector = terminatedSelector
|
||||
return gcc.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
|
||||
@@ -89,7 +89,7 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return jm.kubeClient.Extensions().Jobs(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&extensions.Job{},
|
||||
@@ -112,7 +112,7 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return jm.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
|
||||
@@ -51,7 +51,7 @@ func NewNamespaceController(kubeClient client.Interface, versions *unversioned.A
|
||||
return kubeClient.Namespaces().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.Namespaces().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return kubeClient.Namespaces().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Namespace{},
|
||||
|
||||
@@ -167,7 +167,7 @@ func NewNodeController(
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return nc.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
@@ -183,7 +183,7 @@ func NewNodeController(
|
||||
return nc.kubeClient.Nodes().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return nc.kubeClient.Nodes().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return nc.kubeClient.Nodes().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Node{},
|
||||
|
||||
@@ -136,7 +136,7 @@ func (m *FakeNodeHandler) UpdateStatus(node *api.Node) (*api.Node, error) {
|
||||
return node, nil
|
||||
}
|
||||
|
||||
func (m *FakeNodeHandler) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
|
||||
func (m *FakeNodeHandler) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func NewPersistentVolumeClaimBinder(kubeClient client.Interface, syncPeriod time
|
||||
return kubeClient.PersistentVolumes().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumes().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return kubeClient.PersistentVolumes().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.PersistentVolume{},
|
||||
@@ -79,7 +79,7 @@ func NewPersistentVolumeClaimBinder(kubeClient client.Interface, syncPeriod time
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return kubeClient.PersistentVolumeClaims(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.PersistentVolumeClaim{},
|
||||
|
||||
@@ -68,7 +68,7 @@ func NewPersistentVolumeRecycler(kubeClient client.Interface, syncPeriod time.Du
|
||||
return kubeClient.PersistentVolumes().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return kubeClient.PersistentVolumes().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return kubeClient.PersistentVolumes().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.PersistentVolume{},
|
||||
|
||||
@@ -112,7 +112,7 @@ func NewReplicationManager(kubeClient client.Interface, resyncPeriod controller.
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return rm.kubeClient.ReplicationControllers(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.ReplicationController{},
|
||||
@@ -153,7 +153,7 @@ func NewReplicationManager(kubeClient client.Interface, resyncPeriod controller.
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return rm.kubeClient.Pods(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Pod{},
|
||||
|
||||
@@ -82,7 +82,8 @@ func NewServiceAccountsController(cl client.Interface, options ServiceAccountsCo
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).List(labels.Everything(), accountSelector)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).Watch(labels.Everything(), accountSelector, options)
|
||||
options.FieldSelector.Selector = accountSelector
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.ServiceAccount{},
|
||||
@@ -99,7 +100,7 @@ func NewServiceAccountsController(cl client.Interface, options ServiceAccountsCo
|
||||
return e.client.Namespaces().List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Namespaces().Watch(labels.Everything(), fields.Everything(), options)
|
||||
return e.client.Namespaces().Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Namespace{},
|
||||
|
||||
@@ -67,7 +67,7 @@ func NewTokensController(cl client.Interface, options TokensControllerOptions) *
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).List(labels.Everything(), fields.Everything())
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
|
||||
return e.client.ServiceAccounts(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.ServiceAccount{},
|
||||
@@ -87,7 +87,8 @@ func NewTokensController(cl client.Interface, options TokensControllerOptions) *
|
||||
return e.client.Secrets(api.NamespaceAll).List(labels.Everything(), tokenSelector)
|
||||
},
|
||||
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
|
||||
return e.client.Secrets(api.NamespaceAll).Watch(labels.Everything(), tokenSelector, options)
|
||||
options.FieldSelector.Selector = tokenSelector
|
||||
return e.client.Secrets(api.NamespaceAll).Watch(options)
|
||||
},
|
||||
},
|
||||
&api.Secret{},
|
||||
|
||||
Reference in New Issue
Block a user