cache/controller: Add ENABLE_CLIENT_GO_WATCH_LIST_ALPHA

This commit is contained in:
Lukasz Szaszkiewicz 2023-03-07 12:34:11 +01:00
parent 194ffd779e
commit 966b26d55c
2 changed files with 7 additions and 0 deletions

View File

@ -415,6 +415,9 @@ func NewCacherFromConfig(config Config) (*Cacher, error) {
// We don't want to terminate all watchers as recreating all watchers puts high load on api-server.
// In most of the cases, leader is reelected within few cycles.
reflector.MaxInternalErrorRetryDuration = time.Second * 30
// since the watch-list is provided by the watch cache instruct
// the reflector to issue a regular LIST against the store
reflector.UseWatchList = false
cacher.watchCache = watchCache
cacher.reflector = reflector

View File

@ -18,6 +18,7 @@ package cache
import (
"errors"
"os"
"sync"
"time"
@ -147,6 +148,9 @@ func (c *controller) Run(stopCh <-chan struct{}) {
if c.config.WatchErrorHandler != nil {
r.watchErrorHandler = c.config.WatchErrorHandler
}
if s := os.Getenv("ENABLE_CLIENT_GO_WATCH_LIST_ALPHA"); len(s) > 0 {
r.UseWatchList = true
}
c.reflectorMutex.Lock()
c.reflector = r