diff --git a/internal/controller/managedcluster_controller.go b/internal/controller/managedcluster_controller.go index c366053fd..a2b6e8e16 100644 --- a/internal/controller/managedcluster_controller.go +++ b/internal/controller/managedcluster_controller.go @@ -577,12 +577,12 @@ func (r *ManagedClusterReconciler) Delete(ctx context.Context, l logr.Logger, ma return ctrl.Result{}, err } - err = r.releaseCluster(ctx, managedCluster.Namespace, managedCluster.Name, managedCluster.Spec.Template) + err = sveltos.DeleteProfile(ctx, r.Client, managedCluster.Namespace, managedCluster.Name) if err != nil { return ctrl.Result{}, err } - err = sveltos.DeleteProfile(ctx, r.Client, managedCluster.Namespace, managedCluster.Name) + err = r.releaseCluster(ctx, managedCluster.Namespace, managedCluster.Name, managedCluster.Spec.Template) if err != nil { return ctrl.Result{}, err }