Skip to content

Commit

Permalink
revert deleteOldPvcs
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdsteelRail committed Feb 7, 2025
1 parent a719d03 commit 96b80a9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/controllers/collaset/pvccontrol/pvc_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (pc *RealPvcControl) DeletePodUnusedPvcs(ctx context.Context, cls *appsv1al

// delete old pvc if new pvc is provisioned and WhenScaled is "Delete"
if collasetutils.PvcPolicyWhenScaled(cls) == appsv1alpha1.DeletePersistentVolumeClaimRetentionPolicyType {
return deleteOldPvcs(pc.client, ctx, cls, newPvcs, oldPvcs, mountedPvcNames)
return deleteOldPvcs(pc.client, ctx, cls, newPvcs, oldPvcs)
}
return nil
}
Expand Down Expand Up @@ -334,13 +334,8 @@ func deleteUnclaimedPvcs(c client.Client, ctx context.Context, cls *appsv1alpha1
return nil
}

func deleteOldPvcs(c client.Client, ctx context.Context, cls *appsv1alpha1.CollaSet, newPvcs, oldPvcs *map[string]*corev1.PersistentVolumeClaim, mountedPvcNames sets.String) error {
func deleteOldPvcs(c client.Client, ctx context.Context, cls *appsv1alpha1.CollaSet, newPvcs, oldPvcs *map[string]*corev1.PersistentVolumeClaim) error {
for pvcTmpName, pvc := range *oldPvcs {
// if pvc is still mounted on pod, keep it
if mountedPvcNames.Has(pvcTmpName) {
continue
}
// if new pvc is not ready, keep this pvc
if _, newPvcExist := (*newPvcs)[pvcTmpName]; !newPvcExist {
continue
}
Expand Down

0 comments on commit 96b80a9

Please sign in to comment.