mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
Switch List/Watch to ListPredicate/WatchPredicate
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/constraint"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic"
|
||||
etcdgeneric "github.com/GoogleCloudPlatform/kubernetes/pkg/registry/generic/etcd"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/pod"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
@@ -53,6 +54,9 @@ func NewREST(h tools.EtcdHelper, factory pod.BoundPodFactory) (*REST, *BindingRE
|
||||
ObjectNameFunc: func(obj runtime.Object) (string, error) {
|
||||
return obj.(*api.Pod).Name, nil
|
||||
},
|
||||
PredicateFunc: func(label, field labels.Selector) generic.Matcher {
|
||||
return pod.MatchPod(label, field)
|
||||
},
|
||||
EndpointName: "pods",
|
||||
|
||||
Helper: h,
|
||||
@@ -92,12 +96,12 @@ func (r *REST) NewList() runtime.Object {
|
||||
|
||||
// List obtains a list of pods with labels that match selector.
|
||||
func (r *REST) List(ctx api.Context, label, field labels.Selector) (runtime.Object, error) {
|
||||
return r.store.List(ctx, pod.MatchPod(label, field))
|
||||
return r.store.List(ctx, label, field)
|
||||
}
|
||||
|
||||
// Watch begins watching for new, changed, or deleted pods.
|
||||
func (r *REST) Watch(ctx api.Context, label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
|
||||
return r.store.Watch(ctx, pod.MatchPod(label, field), resourceVersion)
|
||||
return r.store.Watch(ctx, label, field, resourceVersion)
|
||||
}
|
||||
|
||||
// Get gets a specific pod specified by its ID.
|
||||
|
Reference in New Issue
Block a user