-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
controller-runtime provides the ability to control the MaxConcurrentReconciles
controller-runtime/pkg/config/controller.go
Lines 47 to 48 in 252af64
// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run. Defaults to 1. | |
MaxConcurrentReconciles int |
This works great to control the concurrency limit at a global level, but I'm looking to limit it per namespace. In my use-case, I am reconciling pods in a particular order and the order only matters within a namespace and for a large cluster it's inefficient to have a global limit of 1.
return ctrl.NewControllerManagedBy(mgr).
Named(ControllerName).
WithOptions(controller.Options{MaxConcurrentReconciles: 1}).
For(&corev1.Pod{}, builder.WithPredicates(predicate.NewPredicateFuncs(func(object client.Object) bool {
pod := object.(*corev1.Pod)
if err := shouldReconcile(pod); err != nil {
mgr.GetLogger().V(4).Info("skipping pod reconciliation: %s", err.Error())
return false
}
return true
}))).
Complete(r)
I realize that not all resources are namespaced so we have to be aware of that in the api.
grosser and dongjiang1989
Metadata
Metadata
Assignees
Labels
No labels