Skip to content

Commit

Permalink
set MaxConcurrentReconciles for VolumeReplication
Browse files Browse the repository at this point in the history
Added option to set MaxConcurrentReconciles
for VolumeReplication which was pending and for
all other controllers this is set in csi-addons#203

Signed-off-by: Madhu Rajanna <[email protected]>
  • Loading branch information
Madhu-1 committed Aug 23, 2022
1 parent 2fc35bb commit 45cd3fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func main() {
Connpool: connPool,
Timeout: defaultTimeout,
Log: ctrl.Log.WithName("controllers").WithName("VolumeReplication"),
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, ctrlOptions); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "VolumeReplication")
os.Exit(1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"k8s.io/apimachinery/pkg/types"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)
Expand Down Expand Up @@ -385,7 +386,7 @@ func (r *VolumeReplicationReconciler) updateReplicationStatus(
}

// SetupWithManager sets up the controller with the Manager.
func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager, ctrlOptions controller.Options) error {
err := r.waitForCrds()
if err != nil {
r.Log.Error(err, "failed to wait for crds")
Expand All @@ -397,7 +398,9 @@ func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager) error {

return ctrl.NewControllerManagedBy(mgr).
For(&replicationv1alpha1.VolumeReplication{}).
WithEventFilter(pred).Complete(r)
WithEventFilter(pred).
WithOptions(ctrlOptions).
Complete(r)
}

func (r *VolumeReplicationReconciler) waitForCrds() error {
Expand Down

0 comments on commit 45cd3fe

Please sign in to comment.