Skip to content

Commit

Permalink
pkg/controller/factory: report fast resync interval ony when > 0 and …
Browse files Browse the repository at this point in the history
…< 60
  • Loading branch information
p0lyn0mial committed Jun 1, 2023
1 parent ab17946 commit ede37b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/factory/base_controller.go
Expand Up @@ -131,6 +131,11 @@ func (c *baseController) Run(ctx context.Context, workers int) {
// runPeriodicalResync is independent from queue
if c.resyncEvery > 0 {
workerWg.Add(1)
if c.resyncEvery < 60*time.Second {
// Warn about too fast resyncs as they might drain the operators QPS.
// This event is cheap as it is only emitted on operator startup.
c.syncContext.Recorder().Warningf("FastControllerResync", "Controller %q resync interval is set to %s which might lead to client request throttling", c.name, c.resyncEvery)
}
go func() {
defer workerWg.Done()
c.runPeriodicalResync(ctx, c.resyncEvery)
Expand Down
6 changes: 0 additions & 6 deletions pkg/controller/factory/factory.go
Expand Up @@ -279,12 +279,6 @@ func (f *Factory) ToController(name string, eventRecorder events.Recorder) Contr
cacheSyncTimeout: defaultCacheSyncTimeout,
}

// Warn about too fast resyncs as they might drain the operators QPS.
// This event is cheap as it is only emitted on operator startup.
if c.resyncEvery.Seconds() < 60 {
ctx.Recorder().Warningf("FastControllerResync", "Controller %q resync interval is set to %s which might lead to client request throttling", name, c.resyncEvery)
}

for i := range f.informerQueueKeys {
for d := range f.informerQueueKeys[i].informers {
informer := f.informerQueueKeys[i].informers[d]
Expand Down

0 comments on commit ede37b9

Please sign in to comment.