Skip to content

Commit

Permalink
Improve logging in delete VR flow
Browse files Browse the repository at this point in the history
Log after important changes to the system in delete VR flow to make it
easier to understand what the system is doing, and how ramen changed the
system.

New logs:
- delete the VR resource
- remove annotations from PV

Improve logs:
- remove annotations, labels, and finalizers from PVC

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs authored and ShyamsundarR committed Oct 1, 2024
1 parent 830f770 commit 7d170b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ func (v *VRGInstance) preparePVCForVRDeletion(pvc *corev1.PersistentVolumeClaim,
pvc.Spec.VolumeName, pvc.Namespace, pvc.Name, v.instance.Namespace, v.instance.Name, err)
}

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

ownerRemoved := rmnutil.ObjectOwnerUnsetIfSet(pvc, vrg)
// Remove VR finalizer from PVC and the annotation (PVC maybe left behind, so remove the annotation)
finalizerRemoved := controllerutil.RemoveFinalizer(pvc, PvcVRFinalizerProtected)
Expand All @@ -470,8 +472,8 @@ func (v *VRGInstance) preparePVCForVRDeletion(pvc *corev1.PersistentVolumeClaim,
pvc.Namespace, pvc.Name, v.instance.Namespace, v.instance.Name, err)
}

log1.Info("PVC update for VR deletion",
"finalizers", pvc.GetFinalizers(), "labels", pvc.GetLabels(), "annotations", pvc.GetAnnotations())
log1.Info("Deleted ramen annotations, labels, and finallizers from PersistentVolumeClaim",
"annotations", pvc.GetAnnotations(), "labels", pvc.GetLabels(), "finalizers", pvc.GetFinalizers())

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

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

return v.ensureVRDeletedFromAPIServer(vrNamespacedName, log)
}

Expand Down

0 comments on commit 7d170b5

Please sign in to comment.