mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-26 15:12:06 +00:00
Don't paginate in listwatch
Kubernetes-commit: 51eb4b50a3a607ba15a215fdcaa50baea5777afb
This commit is contained in:
parent
526b2fff52
commit
f229b70415
8
tools/cache/listwatch.go
vendored
8
tools/cache/listwatch.go
vendored
@ -17,14 +17,11 @@ limitations under the License.
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
"k8s.io/client-go/tools/pager"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Lister is any object that knows how to perform an initial list.
|
// Lister is any object that knows how to perform an initial list.
|
||||||
@ -102,9 +99,8 @@ func NewFilteredListWatchFromClient(c Getter, resource string, namespace string,
|
|||||||
|
|
||||||
// List a set of apiserver resources
|
// List a set of apiserver resources
|
||||||
func (lw *ListWatch) List(options metav1.ListOptions) (runtime.Object, error) {
|
func (lw *ListWatch) List(options metav1.ListOptions) (runtime.Object, error) {
|
||||||
if !lw.DisableChunking {
|
// ListWatch is used in Reflector, which already supports pagination.
|
||||||
return pager.New(pager.SimplePageFunc(lw.ListFunc)).List(context.TODO(), options)
|
// Don't paginate here to avoid duplication.
|
||||||
}
|
|
||||||
return lw.ListFunc(options)
|
return lw.ListFunc(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user