Skip to content

Commit 024b958

Browse files
authored
Set MaxConcurrentReconciles for VMIC and PolicyEvaluation controllers (#1427)
This PR sets the `MaxConcurrentReconciles` option when adding VMIC and PolicyEvaluation controllers to `ctx.MaxConcurrentReconciles` (20 with default VMOP configs). These resources are 1:1 mapping to VM so we need to enable concurrent reconciles to not block VM reconciliation. If the option is not set, it defaults to 1 as per controller-runtime: https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/controller/controller.go#L48-L49
1 parent 09f7f04 commit 024b958

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

controllers/virtualmachineimagecache/virtualmachineimagecache_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) err
8181
return ctrl.NewControllerManagedBy(mgr).
8282
For(controlledType).
8383
WithOptions(controller.Options{
84-
SkipNameValidation: SkipNameValidation,
85-
LogConstructor: pkglog.ControllerLogConstructor(controllerNameShort, controlledType, mgr.GetScheme()),
84+
MaxConcurrentReconciles: ctx.MaxConcurrentReconciles,
85+
SkipNameValidation: SkipNameValidation,
86+
LogConstructor: pkglog.ControllerLogConstructor(controllerNameShort, controlledType, mgr.GetScheme()),
8687
}).
8788
WatchesRawSource(source.Channel(
8889
cource.FromContextWithBuffer(ctx, "VirtualMachineImageCache", 100),

controllers/vspherepolicy/policyevaluation/policyevaluation_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func AddToManager(ctx *pkgctx.ControllerManagerContext, mgr manager.Manager) err
6868
handler.EnqueueRequestsFromMapFunc(
6969
tagPolicyToPolicyEvaluationMapperFn(ctx, r.Client))).
7070
WithOptions(controller.Options{
71+
MaxConcurrentReconciles: ctx.MaxConcurrentReconciles,
7172
LogConstructor: pkglog.ControllerLogConstructor(
7273
controllerNameShort,
7374
controlledType,

0 commit comments

Comments
 (0)