mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-04 00:24:59 +00:00
Remove use of (Label|Field)SelectorParam
Kubernetes-commit: b6d9815b95940002545b4aa7affb892d94637a49
This commit is contained in:
committed by
Kubernetes Publisher
parent
0e9b63a3bb
commit
3954f889c7
4
tools/cache/listwatch.go
vendored
4
tools/cache/listwatch.go
vendored
@@ -58,21 +58,21 @@ type Getter interface {
|
|||||||
// NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector.
|
// NewListWatchFromClient creates a new ListWatch from the specified client, resource, namespace and field selector.
|
||||||
func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
|
func NewListWatchFromClient(c Getter, resource string, namespace string, fieldSelector fields.Selector) *ListWatch {
|
||||||
listFunc := func(options metav1.ListOptions) (runtime.Object, error) {
|
listFunc := func(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
|
options.FieldSelector = fieldSelector.String()
|
||||||
return c.Get().
|
return c.Get().
|
||||||
Namespace(namespace).
|
Namespace(namespace).
|
||||||
Resource(resource).
|
Resource(resource).
|
||||||
VersionedParams(&options, metav1.ParameterCodec).
|
VersionedParams(&options, metav1.ParameterCodec).
|
||||||
FieldsSelectorParam(fieldSelector).
|
|
||||||
Do().
|
Do().
|
||||||
Get()
|
Get()
|
||||||
}
|
}
|
||||||
watchFunc := func(options metav1.ListOptions) (watch.Interface, error) {
|
watchFunc := func(options metav1.ListOptions) (watch.Interface, error) {
|
||||||
options.Watch = true
|
options.Watch = true
|
||||||
|
options.FieldSelector = fieldSelector.String()
|
||||||
return c.Get().
|
return c.Get().
|
||||||
Namespace(namespace).
|
Namespace(namespace).
|
||||||
Resource(resource).
|
Resource(resource).
|
||||||
VersionedParams(&options, metav1.ParameterCodec).
|
VersionedParams(&options, metav1.ParameterCodec).
|
||||||
FieldsSelectorParam(fieldSelector).
|
|
||||||
Watch()
|
Watch()
|
||||||
}
|
}
|
||||||
return &ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}
|
return &ListWatch{ListFunc: listFunc, WatchFunc: watchFunc}
|
||||||
|
Reference in New Issue
Block a user