forked from red-hat-storage/kubernetes-csi-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set MaxConcurrentReconciles for VolumeReplication
Added option to set MaxConcurrentReconciles for VolumeReplication which was pending and for all other controllers this is set in red-hat-storage#203 Signed-off-by: Madhu Rajanna <[email protected]>
- Loading branch information
Showing
4 changed files
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ 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/log" | ||
"sigs.k8s.io/controller-runtime/pkg/predicate" | ||
"sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
) | ||
|
@@ -59,7 +61,6 @@ var ( | |
// VolumeReplicationReconciler reconciles a VolumeReplication object. | ||
type VolumeReplicationReconciler struct { | ||
client.Client | ||
Log logr.Logger | ||
Scheme *runtime.Scheme | ||
// ConnectionPool consists of map of Connection objects | ||
Connpool *conn.ConnectionPool | ||
|
@@ -81,7 +82,7 @@ type VolumeReplicationReconciler struct { | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
logger := r.Log.WithValues("Request.Name", req.Name, "Request.Namespace", req.Namespace) | ||
logger := log.FromContext(ctx, "Request.Name", req.Name, "Request.Namespace", req.Namespace) | ||
|
||
// Fetch VolumeReplication instance | ||
instance := &replicationv1alpha1.VolumeReplication{} | ||
|
@@ -385,10 +386,9 @@ 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") | ||
|
||
return err | ||
} | ||
|
@@ -397,11 +397,13 @@ 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 { | ||
logger := r.Log.WithName("checkingDependencies") | ||
logger := log.FromContext(context.TODO(), "Name", "checkingDependencies") | ||
|
||
err := r.waitForVolumeReplicationResource(logger, volumeReplicationClass) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters