Skip to content

Commit

Permalink
Improve logging in delete VR flow
Browse files Browse the repository at this point in the history
Log before import changes to the system in delete VR flow:
- deleting the VR resource
- updating the PV for removing annotations and retain policy
- updating the PVC for removing ramen annotations and finalizers

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Sep 24, 2024
1 parent 589bde3 commit fa08a87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,8 @@ func (v *VRGInstance) preparePVCForVRDeletion(pvc *corev1.PersistentVolumeClaim,

delete(pv.Annotations, pvcVRAnnotationArchivedKey)

log.Info("Deleting ramen annotations from PersistentVolume", "pv", pv.Name)

if err := v.reconciler.Update(v.ctx, &pv); err != nil {
log.Error(err, "Failed to update PersistentVolume for VR deletion")

Expand All @@ -462,6 +464,8 @@ func (v *VRGInstance) preparePVCForVRDeletion(pvc *corev1.PersistentVolumeClaim,

log1 := log.WithValues("owner removed", ownerRemoved, "finalizer removed", finalizerRemoved)

log1.Info("Deleting ramen annotations and finallizers from PersistentVolumeClaim")

if err := v.reconciler.Update(v.ctx, pvc); err != nil {
log1.Error(err, "Failed to update PersistentVolumeClaim for VR deletion")

Expand Down Expand Up @@ -1806,6 +1810,8 @@ func (v *VRGInstance) deleteVR(vrNamespacedName types.NamespacedName, log logr.L
},
}

v.log.Info("Deleting VolumeReplication resource %s/%s", vrNamespacedName.Namespace, vrNamespacedName.Name)

err := v.reconciler.Delete(v.ctx, cr)
if err != nil {
if !k8serrors.IsNotFound(err) {
Expand Down

0 comments on commit fa08a87

Please sign in to comment.