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 23, 2024
1 parent 4560d3c commit 432b7b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/controller/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ 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 +463,7 @@ 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 +1808,7 @@ 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 432b7b9

Please sign in to comment.