Skip to content

Commit

Permalink
addons: move the fetching of cephfsid only for non-provider mode
Browse files Browse the repository at this point in the history
Signed-off-by: Rewant Soni <[email protected]>
  • Loading branch information
rewantsoni committed Dec 17, 2024
1 parent 27674c2 commit 026d0d0
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions addons/agent_mirrorpeer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,17 @@ func (r *MirrorPeerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{}, err
}

clusterFSIDs := make(map[string]string)
logger.Info("Fetching clusterFSIDs")
err = r.fetchClusterFSIDs(ctx, &mirrorPeer, clusterFSIDs)
if err != nil {
if errors.IsNotFound(err) {
return ctrl.Result{RequeueAfter: 60 * time.Second}, nil
if !hasStorageClientRef {
clusterFSIDs := make(map[string]string)
logger.Info("Fetching clusterFSIDs")
err = r.fetchClusterFSIDs(ctx, &mirrorPeer, clusterFSIDs)
if err != nil {
if errors.IsNotFound(err) {
return ctrl.Result{RequeueAfter: 60 * time.Second}, nil
}
return ctrl.Result{}, fmt.Errorf("an unknown error occurred while fetching the cluster fsids, retrying again: %v", err)
}
return ctrl.Result{}, fmt.Errorf("an unknown error occurred while fetching the cluster fsids, retrying again: %v", err)
}

if !hasStorageClientRef {
logger.Info("Labeling RBD storageclasses")
errs := r.labelStorageClasses(ctx, scr.Namespace, clusterFSIDs)
if len(errs) > 0 {
Expand All @@ -168,25 +168,25 @@ func (r *MirrorPeerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
if len(errs) > 0 {
return ctrl.Result{}, fmt.Errorf("few failures occurred while labeling VolumeSnapshotClasses: %v", errs)
}
}

if mirrorPeer.Spec.Type == multiclusterv1alpha1.Async && !hasStorageClientRef {
logger.Info("Enabling async mode dependencies")
err = r.labelCephClusters(ctx, scr, clusterFSIDs)
if err != nil {
logger.Error("Failed to label cephcluster", "error", err)
return ctrl.Result{}, err
}
err = r.enableCSIAddons(ctx, scr.Namespace)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to start CSI Addons for rook: %v", err)
}
if mirrorPeer.Spec.Type == multiclusterv1alpha1.Async {
logger.Info("Enabling async mode dependencies")
err = r.labelCephClusters(ctx, scr, clusterFSIDs)
if err != nil {
logger.Error("Failed to label cephcluster", "error", err)
return ctrl.Result{}, err
}
err = r.enableCSIAddons(ctx, scr.Namespace)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to start CSI Addons for rook: %v", err)
}

err = r.enableMirroring(ctx, scr.Name, scr.Namespace, &mirrorPeer)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to enable mirroring the storagecluster %q in namespace %q in managed cluster: %v", scr.Name, scr.Namespace, err)
}
err = r.enableMirroring(ctx, scr.Name, scr.Namespace, &mirrorPeer)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to enable mirroring the storagecluster %q in namespace %q in managed cluster: %v", scr.Name, scr.Namespace, err)
}

}
}

if mirrorPeer.Spec.Type == multiclusterv1alpha1.Async && hasStorageClientRef {
Expand Down

0 comments on commit 026d0d0

Please sign in to comment.