Enable API chunking and promote to beta for 1.9

All list watchers default to using chunking.

Kubernetes-commit: 113889e72da573946f3389b628251647c2a858b9
This commit is contained in:
Clayton Coleman 2017-09-23 15:21:54 -04:00 committed by Kubernetes Publisher
parent 41b0611ef6
commit f49c543e2a

View File

@ -51,8 +51,7 @@ type WatchFunc func(options metav1.ListOptions) (watch.Interface, error)
type ListWatch struct { type ListWatch struct {
ListFunc ListFunc ListFunc ListFunc
WatchFunc WatchFunc WatchFunc WatchFunc
// DisableChunking requests no chunking for this list watcher. It has no effect in Kubernetes 1.8, but in // DisableChunking requests no chunking for this list watcher.
// 1.9 will allow a controller to opt out of chunking.
DisableChunking bool DisableChunking bool
} }
@ -93,9 +92,7 @@ func timeoutFromListOptions(options metav1.ListOptions) time.Duration {
// 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) {
// chunking will become the default for list watchers starting in Kubernetes 1.9, unless if !lw.DisableChunking {
// otherwise disabled.
if false && !lw.DisableChunking {
return pager.New(pager.SimplePageFunc(lw.ListFunc)).List(context.TODO(), options) return pager.New(pager.SimplePageFunc(lw.ListFunc)).List(context.TODO(), options)
} }
return lw.ListFunc(options) return lw.ListFunc(options)