Skip to content

Commit

Permalink
Return not found error
Browse files Browse the repository at this point in the history
The commit fixes a bug where it throws a nil pointer reference when no error
or mirrorpeer is returned from the function

Signed-off-by: vbadrina <[email protected]>
  • Loading branch information
vbnrh authored and openshift-cherrypick-robot committed Apr 24, 2024
1 parent 046d749 commit 0e3239d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/drpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (r *DRPolicyReconciler) getMirrorPeerForClusterSet(ctx context.Context, clu
}

klog.Info("could not find any mirrorpeer for drpolicy")
return nil, nil
return nil, k8serrors.NewNotFound(schema.GroupResource{Group: multiclusterv1alpha1.GroupVersion.Group, Resource: "MirrorPeer"}, fmt.Sprintf("ClusterSet-%s-%s", clusterSet[0], clusterSet[1]))
}
func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
klog.Infof("running DRPolicy reconciler on hub cluster")
Expand Down

0 comments on commit 0e3239d

Please sign in to comment.