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

🌱cleanup: using Complete() instead of Build() when there is no need to return a controller #5210

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion cmd/clusterctl/client/cluster/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (k *proxy) GetConfig() (*rest.Config, error) {
}
restConfig.UserAgent = fmt.Sprintf("clusterctl/%s (%s)", version.Get().GitVersion, version.Get().Platform)

// Set QPS and Burst to a threshold that ensures the controller runtime client/client go does't generate throttling log messages
// Set QPS and Burst to a threshold that ensures the controller runtime client/client go doesn't generate throttling log messages
restConfig.QPS = 20
restConfig.Burst = 100

Expand Down
4 changes: 2 additions & 2 deletions controllers/remote/cluster_cache_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ type ClusterCacheReconciler struct {
}

func (r *ClusterCacheReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
_, err := ctrl.NewControllerManagedBy(mgr).
err := ctrl.NewControllerManagedBy(mgr).
For(&clusterv1.Cluster{}).
WithOptions(options).
WithEventFilter(predicates.ResourceHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
Build(r)
Complete(r)

if err != nil {
return errors.Wrap(err, "failed setting up with a controller manager")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ type ClusterResourceSetBindingReconciler struct {
}

func (r *ClusterResourceSetBindingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
_, err := ctrl.NewControllerManagedBy(mgr).
err := ctrl.NewControllerManagedBy(mgr).
For(&addonsv1.ClusterResourceSetBinding{}).
Watches(
&source.Kind{Type: &clusterv1.Cluster{}},
handler.EnqueueRequestsFromMapFunc(r.clusterToClusterResourceSetBinding),
).
WithOptions(options).
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
Build(r)
Complete(r)
if err != nil {
return errors.Wrap(err, "failed setting up with a controller manager")
}
Expand Down