Skip to content

Commit

Permalink
chore: retain the restore cr after the cluster recovery is completed. (
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Mar 1, 2024
1 parent 7f4f352 commit 88ba342
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions pkg/controller/plan/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ func (r *RestoreManager) DoRestore(comp *component.SynthesizedComponent, compObj
return err
}
// do clean up
if err = r.cleanupClusterAnnotations(comp.Name); err != nil {
return err
}
return r.cleanupRestores(comp)
return r.cleanupClusterAnnotations(comp.Name)
}

func (r *RestoreManager) DoPrepareData(comp *component.SynthesizedComponent,
Expand Down Expand Up @@ -372,19 +369,3 @@ func (r *RestoreManager) cleanupClusterAnnotations(compName string) error {
}
return nil
}

func (r *RestoreManager) cleanupRestores(comp *component.SynthesizedComponent) error {
if r.Cluster.Status.Phase != appsv1alpha1.RunningClusterPhase {
return nil
}
restoreList := &dpv1alpha1.RestoreList{}
if err := r.Client.List(r.Ctx, restoreList, client.MatchingLabels(constant.GetKBWellKnownLabels(comp.ClusterDefName, r.Cluster.Name, comp.Name))); err != nil {
return err
}
for i := range restoreList.Items {
if err := intctrlutil.BackgroundDeleteObject(r.Client, r.Ctx, &restoreList.Items[i]); err != nil {
return err
}
}
return nil
}

0 comments on commit 88ba342

Please sign in to comment.