Merge pull request #83536 from yutedz/del-volume-err

Log the error return from store.Delete
This commit is contained in:
Kubernetes Prow Robot 2019-10-08 19:59:50 -07:00 committed by GitHub
commit ac9390627e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,8 +210,11 @@ func (ctrl *PersistentVolumeController) updateVolume(volume *v1.PersistentVolume
// deleteVolume runs in worker thread and handles "volume deleted" event.
func (ctrl *PersistentVolumeController) deleteVolume(volume *v1.PersistentVolume) {
_ = ctrl.volumes.store.Delete(volume)
klog.V(4).Infof("volume %q deleted", volume.Name)
if err := ctrl.volumes.store.Delete(volume); err != nil {
klog.Errorf("volume %q deletion encountered : %v", volume.Name, err)
} else {
klog.V(4).Infof("volume %q deleted", volume.Name)
}
// record deletion metric if a deletion start timestamp is in the cache
// the following calls will be a no-op if there is nothing for this volume in the cache
// end of timestamp cache entry lifecycle, "RecordMetric" will do the clean
@ -255,7 +258,9 @@ func (ctrl *PersistentVolumeController) updateClaim(claim *v1.PersistentVolumeCl
// Unit test [5-5] [5-6] [5-7]
// deleteClaim runs in worker thread and handles "claim deleted" event.
func (ctrl *PersistentVolumeController) deleteClaim(claim *v1.PersistentVolumeClaim) {
_ = ctrl.claims.Delete(claim)
if err := ctrl.claims.Delete(claim); err != nil {
klog.Errorf("claim %q deletion encountered : %v", claim.Name, err)
}
claimKey := claimToClaimKey(claim)
klog.V(4).Infof("claim %q deleted", claimKey)
// clean any possible unfinished provision start timestamp from cache