Simplify Watch() signature in clients.

This commit is contained in:
Wojciech Tyczynski 2015-11-26 16:27:45 +01:00
parent ea14d1c309
commit d2dfc912e6
77 changed files with 172 additions and 183 deletions

View File

@ -63,7 +63,7 @@ func NewEndpointController(client *client.Client) *endpointController {
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{},
@ -83,7 +83,7 @@ func NewEndpointController(client *client.Client) *endpointController {
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{},

View File

@ -37,7 +37,7 @@ type DaemonSetInterface interface {
Update(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
UpdateStatus(ctrl *extensions.DaemonSet) (*extensions.DaemonSet, error)
Delete(name string) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// daemonSets implements DaemonsSetsNamespacer interface
@ -93,13 +93,11 @@ func (c *daemonSets) Delete(name string) error {
}
// Watch returns a watch.Interface that watches the requested daemon sets.
func (c *daemonSets) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *daemonSets) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("daemonsets").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -38,7 +38,7 @@ type DeploymentInterface interface {
Create(*extensions.Deployment) (*extensions.Deployment, error)
Update(*extensions.Deployment) (*extensions.Deployment, error)
UpdateStatus(*extensions.Deployment) (*extensions.Deployment, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// deployments implements DeploymentInterface
@ -102,13 +102,11 @@ func (c *deployments) UpdateStatus(deployment *extensions.Deployment) (result *e
}
// Watch returns a watch.Interface that watches the requested deployments.
func (c *deployments) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *deployments) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("deployments").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -169,6 +169,6 @@ func TestDeploymentWatch(t *testing.T) {
},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).Deployments(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).Deployments(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -38,7 +38,7 @@ type EndpointsInterface interface {
Get(name string) (*api.Endpoints, error)
Delete(name string) error
Update(endpoints *api.Endpoints) (*api.Endpoints, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// endpoints implements EndpointsInterface
@ -85,14 +85,12 @@ func (c *endpoints) Delete(name string) error {
}
// Watch returns a watch.Interface that watches the requested endpoints for a service.
func (c *endpoints) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *endpoints) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("endpoints").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -39,7 +39,7 @@ type EventInterface interface {
Patch(event *api.Event, data []byte) (*api.Event, error)
List(label labels.Selector, field fields.Selector) (*api.EventList, error)
Get(name string) (*api.Event, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
// Search finds events about the specified object
Search(objOrRef runtime.Object) (*api.EventList, error)
Delete(name string) error
@ -142,14 +142,12 @@ func (e *events) Get(name string) (*api.Event, error) {
}
// Watch starts watching for events matching the given selectors.
func (e *events) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (e *events) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return e.client.Get().
Prefix("watch").
NamespaceIfScoped(e.namespace, len(e.namespace) > 0).
Resource("events").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -38,7 +38,7 @@ type HorizontalPodAutoscalerInterface interface {
Create(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
Update(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
UpdateStatus(horizontalPodAutoscaler *extensions.HorizontalPodAutoscaler) (*extensions.HorizontalPodAutoscaler, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// horizontalPodAutoscalers implements HorizontalPodAutoscalersNamespacer interface
@ -104,13 +104,11 @@ func (c *horizontalPodAutoscalers) UpdateStatus(horizontalPodAutoscaler *extensi
}
// Watch returns a watch.Interface that watches the requested horizontalPodAutoscalers.
func (c *horizontalPodAutoscalers) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *horizontalPodAutoscalers) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("horizontalPodAutoscalers").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -156,6 +156,6 @@ func TestHorizontalPodAutoscalerWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).Extensions().HorizontalPodAutoscalers(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -37,7 +37,7 @@ type IngressInterface interface {
Create(ingress *extensions.Ingress) (*extensions.Ingress, error)
Update(ingress *extensions.Ingress) (*extensions.Ingress, error)
Delete(name string, options *api.DeleteOptions) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
UpdateStatus(ingress *extensions.Ingress) (*extensions.Ingress, error)
}
@ -94,14 +94,12 @@ func (c *ingress) Delete(name string, options *api.DeleteOptions) (err error) {
}
// Watch returns a watch.Interface that watches the requested ingress.
func (c *ingress) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *ingress) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("ingresses").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -38,7 +38,7 @@ type JobInterface interface {
Create(job *extensions.Job) (*extensions.Job, error)
Update(job *extensions.Job) (*extensions.Job, error)
Delete(name string, options *api.DeleteOptions) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
UpdateStatus(job *extensions.Job) (*extensions.Job, error)
}
@ -98,14 +98,12 @@ func (c *jobs) Delete(name string, options *api.DeleteOptions) (err error) {
}
// Watch returns a watch.Interface that watches the requested jobs.
func (c *jobs) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *jobs) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -38,7 +38,7 @@ type LimitRangeInterface interface {
Delete(name string) error
Create(limitRange *api.LimitRange) (*api.LimitRange, error)
Update(limitRange *api.LimitRange) (*api.LimitRange, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// limitRanges implements LimitRangesNamespacer interface
@ -93,13 +93,11 @@ func (c *limitRanges) Update(limitRange *api.LimitRange) (result *api.LimitRange
}
// Watch returns a watch.Interface that watches the requested resource
func (c *limitRanges) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *limitRanges) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("limitRanges").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -208,6 +208,6 @@ func TestLimitRangeWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).LimitRanges(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).LimitRanges(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -36,7 +36,7 @@ type NamespaceInterface interface {
List(label labels.Selector, field fields.Selector) (*api.NamespaceList, error)
Delete(name string) error
Update(item *api.Namespace) (*api.Namespace, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
Finalize(item *api.Namespace) (*api.Namespace, error)
Status(item *api.Namespace) (*api.Namespace, error)
}
@ -115,12 +115,10 @@ func (c *namespaces) Delete(name string) error {
}
// Watch returns a watch.Interface that watches the requested namespaces.
func (c *namespaces) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *namespaces) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Resource("namespaces").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -175,6 +175,6 @@ func TestNamespaceWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).Namespaces().Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).Namespaces().Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -37,7 +37,7 @@ type NodeInterface interface {
Delete(name string) error
Update(*api.Node) (*api.Node, error)
UpdateStatus(*api.Node) (*api.Node, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// nodes implements NodesInterface
@ -103,13 +103,11 @@ func (c *nodes) UpdateStatus(node *api.Node) (*api.Node, error) {
}
// Watch returns a watch.Interface that watches the requested nodes.
func (c *nodes) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *nodes) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(api.NamespaceAll).
Resource(c.resourceName()).
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -181,6 +181,6 @@ func TestPersistentVolumeWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).PersistentVolumes().Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).PersistentVolumes().Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -39,7 +39,7 @@ type PersistentVolumeClaimInterface interface {
Update(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error)
Delete(name string) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// persistentVolumeClaims implements PersistentVolumeClaimsNamespacer interface
@ -99,13 +99,11 @@ func (c *persistentVolumeClaims) Delete(name string) error {
return c.client.Delete().Namespace(c.namespace).Resource("persistentVolumeClaims").Name(name).Do().Error()
}
func (c *persistentVolumeClaims) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *persistentVolumeClaims) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.namespace).
Resource("persistentVolumeClaims").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -198,6 +198,6 @@ func TestPersistentVolumeClaimWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).PersistentVolumeClaims(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).PersistentVolumeClaims(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -38,7 +38,7 @@ type PersistentVolumeInterface interface {
Update(volume *api.PersistentVolume) (*api.PersistentVolume, error)
UpdateStatus(persistentVolume *api.PersistentVolume) (*api.PersistentVolume, error)
Delete(name string) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// persistentVolumes implements PersistentVolumesInterface
@ -94,12 +94,10 @@ func (c *persistentVolumes) Delete(name string) error {
return c.client.Delete().Resource("persistentVolumes").Name(name).Do().Error()
}
func (c *persistentVolumes) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *persistentVolumes) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("persistentVolumes").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -36,7 +36,7 @@ type PodTemplateInterface interface {
Delete(name string, options *api.DeleteOptions) error
Create(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
Update(podTemplate *api.PodTemplate) (*api.PodTemplate, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// podTemplates implements PodTemplatesNamespacer interface
@ -95,13 +95,11 @@ func (c *podTemplates) Update(podTemplate *api.PodTemplate) (result *api.PodTemp
}
// Watch returns a watch.Interface that watches the requested podTemplates.
func (c *podTemplates) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *podTemplates) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("podTemplates").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -138,6 +138,6 @@ func TestPodTemplateWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).PodTemplates(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).PodTemplates(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -36,7 +36,7 @@ type PodInterface interface {
Delete(name string, options *api.DeleteOptions) error
Create(pod *api.Pod) (*api.Pod, error)
Update(pod *api.Pod) (*api.Pod, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
Bind(binding *api.Binding) error
UpdateStatus(pod *api.Pod) (*api.Pod, error)
GetLogs(name string, opts *api.PodLogOptions) *Request
@ -98,14 +98,12 @@ func (c *pods) Update(pod *api.Pod) (result *api.Pod, err error) {
}
// Watch returns a watch.Interface that watches the requested pods.
func (c *pods) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *pods) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("pods").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -37,7 +37,7 @@ type ReplicationControllerInterface interface {
Update(ctrl *api.ReplicationController) (*api.ReplicationController, error)
UpdateStatus(ctrl *api.ReplicationController) (*api.ReplicationController, error)
Delete(name string) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// replicationControllers implements ReplicationControllersNamespacer interface
@ -92,13 +92,11 @@ func (c *replicationControllers) Delete(name string) error {
}
// Watch returns a watch.Interface that watches the requested controllers.
func (c *replicationControllers) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *replicationControllers) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("replicationControllers").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -37,7 +37,7 @@ type ResourceQuotaInterface interface {
Create(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
Update(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// resourceQuotas implements ResourceQuotasNamespacer interface
@ -95,13 +95,11 @@ func (c *resourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (result
}
// Watch returns a watch.Interface that watches the requested resource
func (c *resourceQuotas) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *resourceQuotas) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("resourceQuotas").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -194,6 +194,6 @@ func TestResourceQuotaWatch(t *testing.T) {
Query: url.Values{"resourceVersion": []string{}}},
Response: Response{StatusCode: 200},
}
_, err := c.Setup(t).ResourceQuotas(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
_, err := c.Setup(t).ResourceQuotas(api.NamespaceAll).Watch(unversioned.ListOptions{})
c.Validate(t, nil, err)
}

View File

@ -34,7 +34,7 @@ type SecretsInterface interface {
Delete(name string) error
List(label labels.Selector, field fields.Selector) (*api.SecretList, error)
Get(name string) (*api.Secret, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// events implements Secrets interface
@ -92,14 +92,12 @@ func (s *secrets) Get(name string) (*api.Secret, error) {
}
// Watch starts watching for secrets matching the given selectors.
func (s *secrets) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (s *secrets) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("secrets").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -34,7 +34,7 @@ type ServiceAccountsInterface interface {
Delete(name string) error
List(label labels.Selector, field fields.Selector) (*api.ServiceAccountList, error)
Get(name string) (*api.ServiceAccount, error)
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
}
// serviceAccounts implements ServiceAccounts interface
@ -92,14 +92,12 @@ func (s *serviceAccounts) Get(name string) (*api.ServiceAccount, error) {
}
// Watch starts watching for serviceAccounts matching the given selectors.
func (s *serviceAccounts) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (s *serviceAccounts) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return s.client.Get().
Prefix("watch").
Namespace(s.namespace).
Resource("serviceAccounts").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -37,7 +37,7 @@ type ServiceInterface interface {
Create(srv *api.Service) (*api.Service, error)
Update(srv *api.Service) (*api.Service, error)
Delete(name string) error
Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error)
Watch(opts unversioned.ListOptions) (watch.Interface, error)
ProxyGet(scheme, name, port, path string, params map[string]string) ResponseWrapper
}
@ -92,14 +92,12 @@ func (c *services) Delete(name string) error {
}
// Watch returns a watch.Interface that watches the requested services.
func (c *services) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
func (c *services) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("services").
VersionedParams(&opts, api.Scheme).
LabelsSelectorParam(label).
FieldsSelectorParam(field).
Watch()
}

View File

@ -150,21 +150,37 @@ func NewDeleteAction(resource, namespace, name string) DeleteActionImpl {
return action
}
func NewRootWatchAction(resource string, label labels.Selector, field fields.Selector, opts unversioned.ListOptions) WatchActionImpl {
func NewRootWatchAction(resource string, opts unversioned.ListOptions) WatchActionImpl {
action := WatchActionImpl{}
action.Verb = "watch"
action.Resource = resource
action.WatchRestrictions = WatchRestrictions{label, field, opts.ResourceVersion}
labelSelector := opts.LabelSelector.Selector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector.Selector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion}
return action
}
func NewWatchAction(resource, namespace string, label labels.Selector, field fields.Selector, opts unversioned.ListOptions) WatchActionImpl {
func NewWatchAction(resource, namespace string, opts unversioned.ListOptions) WatchActionImpl {
action := WatchActionImpl{}
action.Verb = "watch"
action.Resource = resource
action.Namespace = namespace
action.WatchRestrictions = WatchRestrictions{label, field, opts.ResourceVersion}
labelSelector := opts.LabelSelector.Selector
if labelSelector == nil {
labelSelector = labels.Everything()
}
fieldSelector := opts.FieldSelector.Selector
if fieldSelector == nil {
fieldSelector = fields.Everything()
}
action.WatchRestrictions = WatchRestrictions{labelSelector, fieldSelector, opts.ResourceVersion}
return action
}

View File

@ -80,6 +80,6 @@ func (c *FakeDaemonSets) Delete(name string) error {
return err
}
func (c *FakeDaemonSets) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("daemonsets", c.Namespace, label, field, opts))
func (c *FakeDaemonSets) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("daemonsets", c.Namespace, opts))
}

View File

@ -87,6 +87,6 @@ func (c *FakeDeployments) Delete(name string, options *api.DeleteOptions) error
return err
}
func (c *FakeDeployments) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("deployments", c.Namespace, label, field, opts))
func (c *FakeDeployments) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("deployments", c.Namespace, opts))
}

View File

@ -72,6 +72,6 @@ func (c *FakeEndpoints) Delete(name string) error {
return err
}
func (c *FakeEndpoints) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("endpoints", c.Namespace, label, field, opts))
func (c *FakeEndpoints) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("endpoints", c.Namespace, opts))
}

View File

@ -112,10 +112,10 @@ func (c *FakeEvents) Delete(name string) error {
}
// Watch starts watching for events matching the given selectors.
func (c *FakeEvents) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
action := NewRootWatchAction("events", label, field, opts)
func (c *FakeEvents) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
action := NewRootWatchAction("events", opts)
if c.Namespace != "" {
action = NewWatchAction("events", c.Namespace, label, field, opts)
action = NewWatchAction("events", c.Namespace, opts)
}
return c.Fake.InvokesWatch(action)
}

View File

@ -86,6 +86,6 @@ func (c *FakeHorizontalPodAutoscalers) Delete(name string, options *api.DeleteOp
return err
}
func (c *FakeHorizontalPodAutoscalers) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("horizontalpodautoscalers", c.Namespace, label, field, opts))
func (c *FakeHorizontalPodAutoscalers) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("horizontalpodautoscalers", c.Namespace, opts))
}

View File

@ -73,8 +73,8 @@ func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error {
return err
}
func (c *FakeIngress) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("ingresses", c.Namespace, label, field, opts))
func (c *FakeIngress) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("ingresses", c.Namespace, opts))
}
func (c *FakeIngress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {

View File

@ -73,8 +73,8 @@ func (c *FakeJobs) Delete(name string, options *api.DeleteOptions) error {
return err
}
func (c *FakeJobs) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, label, field, opts))
func (c *FakeJobs) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("jobs", c.Namespace, opts))
}
func (c *FakeJobs) UpdateStatus(job *extensions.Job) (result *extensions.Job, err error) {

View File

@ -72,6 +72,6 @@ func (c *FakeLimitRanges) Delete(name string) error {
return err
}
func (c *FakeLimitRanges) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("limitranges", c.Namespace, label, field, opts))
func (c *FakeLimitRanges) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("limitranges", c.Namespace, opts))
}

View File

@ -71,8 +71,8 @@ func (c *FakeNamespaces) Delete(name string) error {
return err
}
func (c *FakeNamespaces) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("namespaces", label, field, opts))
func (c *FakeNamespaces) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("namespaces", opts))
}
func (c *FakeNamespaces) Finalize(namespace *api.Namespace) (*api.Namespace, error) {

View File

@ -71,8 +71,8 @@ func (c *FakeNodes) Delete(name string) error {
return err
}
func (c *FakeNodes) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("nodes", label, field, opts))
func (c *FakeNodes) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("nodes", opts))
}
func (c *FakeNodes) UpdateStatus(node *api.Node) (*api.Node, error) {

View File

@ -70,8 +70,8 @@ func (c *FakePersistentVolumeClaims) Delete(name string) error {
return err
}
func (c *FakePersistentVolumeClaims) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("persistentvolumeclaims", c.Namespace, label, field, opts))
func (c *FakePersistentVolumeClaims) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("persistentvolumeclaims", c.Namespace, opts))
}
func (c *FakePersistentVolumeClaims) UpdateStatus(claim *api.PersistentVolumeClaim) (*api.PersistentVolumeClaim, error) {

View File

@ -69,8 +69,8 @@ func (c *FakePersistentVolumes) Delete(name string) error {
return err
}
func (c *FakePersistentVolumes) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", label, field, opts))
func (c *FakePersistentVolumes) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewRootWatchAction("persistentvolumes", opts))
}
func (c *FakePersistentVolumes) UpdateStatus(pv *api.PersistentVolume) (*api.PersistentVolume, error) {

View File

@ -72,6 +72,6 @@ func (c *FakePodTemplates) Delete(name string, options *api.DeleteOptions) error
return err
}
func (c *FakePodTemplates) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("podtemplates", c.Namespace, label, field, opts))
func (c *FakePodTemplates) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("podtemplates", c.Namespace, opts))
}

View File

@ -78,8 +78,8 @@ func (c *FakePods) Delete(name string, options *api.DeleteOptions) error {
return err
}
func (c *FakePods) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("pods", c.Namespace, label, field, opts))
func (c *FakePods) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("pods", c.Namespace, opts))
}
func (c *FakePods) Bind(binding *api.Binding) error {

View File

@ -80,6 +80,6 @@ func (c *FakeReplicationControllers) Delete(name string) error {
return err
}
func (c *FakeReplicationControllers) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("replicationcontrollers", c.Namespace, label, field, opts))
func (c *FakeReplicationControllers) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("replicationcontrollers", c.Namespace, opts))
}

View File

@ -72,8 +72,8 @@ func (c *FakeResourceQuotas) Delete(name string) error {
return err
}
func (c *FakeResourceQuotas) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("resourcequotas", c.Namespace, label, field, opts))
func (c *FakeResourceQuotas) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("resourcequotas", c.Namespace, opts))
}
func (c *FakeResourceQuotas) UpdateStatus(resourceQuota *api.ResourceQuota) (*api.ResourceQuota, error) {

View File

@ -72,6 +72,6 @@ func (c *FakeSecrets) Delete(name string) error {
return err
}
func (c *FakeSecrets) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("secrets", c.Namespace, label, field, opts))
func (c *FakeSecrets) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("secrets", c.Namespace, opts))
}

View File

@ -72,6 +72,6 @@ func (c *FakeServiceAccounts) Delete(name string) error {
return err
}
func (c *FakeServiceAccounts) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("serviceaccounts", c.Namespace, label, field, opts))
func (c *FakeServiceAccounts) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("serviceaccounts", c.Namespace, opts))
}

View File

@ -73,8 +73,8 @@ func (c *FakeServices) Delete(name string) error {
return err
}
func (c *FakeServices) Watch(label labels.Selector, field fields.Selector, opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("services", c.Namespace, label, field, opts))
func (c *FakeServices) Watch(opts unversioned.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("services", c.Namespace, opts))
}
func (c *FakeServices) ProxyGet(scheme, name, port, path string, params map[string]string) client.ResponseWrapper {

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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
}

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -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{},

View File

@ -240,7 +240,7 @@ func NewMainKubelet(
return kubeClient.Services(api.NamespaceAll).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return kubeClient.Services(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), options)
return kubeClient.Services(api.NamespaceAll).Watch(options)
},
}
cache.NewReflector(listWatch, &api.Service{}, serviceStore, 0).Run()
@ -257,7 +257,8 @@ func NewMainKubelet(
return kubeClient.Nodes().List(labels.Everything(), fieldSelector)
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return kubeClient.Nodes().Watch(labels.Everything(), fieldSelector, options)
options.FieldSelector.Selector = fieldSelector
return kubeClient.Nodes().Watch(options)
},
}
cache.NewReflector(listWatch, &api.Node{}, nodeStore, 0).Run()

View File

@ -113,7 +113,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace, resourceVersion string, s
return c.client.Pods(namespace).List(labels.Everything(), fieldSelector)
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return c.client.Pods(namespace).Watch(labels.Everything(), fieldSelector, options)
options.FieldSelector.Selector = fieldSelector
return c.client.Pods(namespace).Watch(options)
},
}
queue := cache.NewFIFO(cache.MetaNamespaceKeyFunc)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -224,7 +224,8 @@ var _ = Describe("DaemonRestart", func() {
return framework.Client.Pods(ns).List(labelSelector, fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return framework.Client.Pods(ns).Watch(labelSelector, fields.Everything(), options)
options.LabelSelector.Selector = labelSelector
return framework.Client.Pods(ns).Watch(options)
},
},
&api.Pod{},

View File

@ -203,7 +203,7 @@ var _ = Describe("Density [Skipped]", func() {
return c.Events(ns).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return c.Events(ns).Watch(labels.Everything(), fields.Everything(), options)
return c.Events(ns).Watch(options)
},
},
&api.Event{},
@ -286,7 +286,8 @@ var _ = Describe("Density [Skipped]", func() {
return c.Pods(ns).List(labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix}), fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return c.Pods(ns).Watch(labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix}), fields.Everything(), options)
options.LabelSelector.Selector = labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix})
return c.Pods(ns).Watch(options)
},
},
&api.Pod{},

View File

@ -194,11 +194,11 @@ func (f *Framework) WaitForAnEndpoint(serviceName string) error {
}
}
w, err := f.Client.Endpoints(f.Namespace.Name).Watch(
labels.Everything(),
fields.Set{"metadata.name": serviceName}.AsSelector(),
unversioned.ListOptions{ResourceVersion: rv},
)
options := unversioned.ListOptions{
FieldSelector: unversioned.FieldSelector{fields.Set{"metadata.name": serviceName}.AsSelector()},
ResourceVersion: rv,
}
w, err := f.Client.Endpoints(f.Namespace.Name).Watch(options)
if err != nil {
return err
}

View File

@ -147,7 +147,8 @@ func runLatencyTest(nodeCount int, c *client.Client, ns string) {
return c.Pods(ns).List(labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix}), fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return c.Pods(ns).Watch(labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix}), fields.Everything(), options)
options.LabelSelector.Selector = labels.SelectorFromSet(labels.Set{"name": additionalPodsPrefix})
return c.Pods(ns).Watch(options)
},
},
&api.Pod{},

View File

@ -305,9 +305,11 @@ var _ = Describe("Pods", func() {
Failf("Failed to query for pods: %v", err)
}
Expect(len(pods.Items)).To(Equal(0))
w, err := podClient.Watch(
labels.SelectorFromSet(labels.Set(map[string]string{"time": value})), fields.Everything(),
unversioned.ListOptions{ResourceVersion: pods.ListMeta.ResourceVersion})
options := unversioned.ListOptions{
LabelSelector: unversioned.LabelSelector{labels.SelectorFromSet(labels.Set(map[string]string{"time": value}))},
ResourceVersion: pods.ListMeta.ResourceVersion,
}
w, err := podClient.Watch(options)
if err != nil {
Failf("Failed to set up watch: %v", err)
}

View File

@ -283,7 +283,7 @@ func startEndpointWatcher(f *Framework, q *endpointQueries) {
return f.Client.Endpoints(f.Namespace.Name).List(labels.Everything(), fields.Everything())
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return f.Client.Endpoints(f.Namespace.Name).Watch(labels.Everything(), fields.Everything(), options)
return f.Client.Endpoints(f.Namespace.Name).Watch(options)
},
},
&api.Endpoints{},

View File

@ -165,7 +165,9 @@ func newPodStore(c *client.Client, namespace string, label labels.Selector, fiel
return c.Pods(namespace).List(label, field)
},
WatchFunc: func(options unversioned.ListOptions) (watch.Interface, error) {
return c.Pods(namespace).Watch(label, field, options)
options.LabelSelector.Selector = label
options.FieldSelector.Selector = field
return c.Pods(namespace).Watch(options)
},
}
store := cache.NewStore(cache.MetaNamespaceKeyFunc)

View File

@ -245,11 +245,11 @@ func TestMultiWatch(t *testing.T) {
t.Fatalf("Couldn't make %v: %v", name, err)
}
go func(name, rv string) {
w, err := client.Pods(ns).Watch(
labels.Set{"watchlabel": name}.AsSelector(),
fields.Everything(),
unversioned.ListOptions{ResourceVersion: rv},
)
options := unversioned.ListOptions{
LabelSelector: unversioned.LabelSelector{labels.Set{"watchlabel": name}.AsSelector()},
ResourceVersion: rv,
}
w, err := client.Pods(ns).Watch(options)
if err != nil {
panic(fmt.Sprintf("watch error for %v: %v", name, err))
}

View File

@ -31,8 +31,6 @@ import (
client "k8s.io/kubernetes/pkg/client/unversioned"
persistentvolumecontroller "k8s.io/kubernetes/pkg/controller/persistentvolume"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/watch"
"k8s.io/kubernetes/test/integration/framework"
@ -78,7 +76,7 @@ func TestPersistentVolumeRecycler(t *testing.T) {
},
}
w, _ := testClient.PersistentVolumes().Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
w, _ := testClient.PersistentVolumes().Watch(unversioned.ListOptions{})
defer w.Stop()
_, _ = testClient.PersistentVolumes().Create(pv)
@ -104,7 +102,7 @@ func TestPersistentVolumeRecycler(t *testing.T) {
// change the reclamation policy of the PV for the next test
pv.Spec.PersistentVolumeReclaimPolicy = api.PersistentVolumeReclaimDelete
w, _ = testClient.PersistentVolumes().Watch(labels.Everything(), fields.Everything(), unversioned.ListOptions{})
w, _ = testClient.PersistentVolumes().Watch(unversioned.ListOptions{})
defer w.Stop()
_, _ = testClient.PersistentVolumes().Create(pv)