Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: configure context timeout for sync resources #1974

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: configure context timeout for sync resources
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan committed Apr 3, 2024
commit 028e6f2117b579b5d6c3eea2c019034b0528e85b
4 changes: 3 additions & 1 deletion pkg/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,10 @@ func Start(ctx context.Context, buildInfo trivyoperator.BuildInfo, operatorConfi
}
}

timeoutCtx, cancel := context.WithTimeout(ctx, *operatorConfig.ControllerCacheSyncTimeout)
defer cancel()
setupLog.Info("Starting controllers manager")
if err := mgr.Start(ctx); err != nil {
if err := mgr.Start(timeoutCtx); err != nil {
return fmt.Errorf("starting controllers manager: %w", err)
}

Expand Down
Loading