Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addons: move the fetching of cephfsid only for non-provider mode #248

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion controllers/mirrorpeer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ func (r *MirrorPeerReconciler) updateMirrorPeerStatus(ctx context.Context, mirro
logger.Error("Error occurred while updating the status of mirrorpeer", "error", statusErr, "MirrorPeer", mirrorPeer.Name)
return ctrl.Result{Requeue: true}, nil
}
return ctrl.Result{}, nil
return ctrl.Result{Requeue: true}, nil
}
} else {
// Sync mode status update, same flow as async but for s3 profile
Expand Down
Loading