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
This commit is contained in:
Phil
2021-05-13 17:44:36 +01:00
committed by sky-philipalmeida
parent f594c25c70
commit f1a9402082

View File

@@ -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) {