From f1a940208214940abe8c081e0cd35342dc674085 Mon Sep 17 00:00:00 2001 From: Phil <16774926+sky-philipalmeida@users.noreply.github.com> Date: Thu, 13 May 2021 17:44:36 +0100 Subject: [PATCH] Log if PV is still in use trying to delete it Similar to what we have in: https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/volume/pvcprotection/pvc_protection_controller.go#L181 The objective is to have a easy way to monitor if a PV will enter in Terminating state due to a failed removal when still in use. This way we can capture the PV log and alert according. The code is not tested. Update pv_protection_controller.go Change call to Infof --- pkg/controller/volume/pvprotection/pv_protection_controller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/controller/volume/pvprotection/pv_protection_controller.go b/pkg/controller/volume/pvprotection/pv_protection_controller.go index 590c8ee44c6..4193283fd91 100644 --- a/pkg/controller/volume/pvprotection/pv_protection_controller.go +++ b/pkg/controller/volume/pvprotection/pv_protection_controller.go @@ -144,6 +144,7 @@ func (c *Controller) processPV(pvName string) error { if !isUsed { return c.removeFinalizer(pv) } + klog.V(4).Infof("Keeping PV %s because it is being used", pvName) } if protectionutil.NeedToAddFinalizer(pv, volumeutil.PVProtectionFinalizer) {