Don't call delete for already deleted volumes

This commit is contained in:
Hemant Kumar
2020-02-18 15:59:47 -05:00
parent d5e0a941aa
commit d9f7a1f311
3 changed files with 31 additions and 0 deletions

View File

@@ -348,6 +348,17 @@ func newVolumeArray(name, capacity, boundToClaimUID, boundToClaimName string, ph
}
}
func withVolumeDeletionTimestamp(pvs []*v1.PersistentVolume) []*v1.PersistentVolume {
result := []*v1.PersistentVolume{}
for _, pv := range pvs {
// Using time.Now() here will cause mismatching deletion timestamps in tests
deleteTime := metav1.Date(2020, time.February, 18, 10, 30, 30, 10, time.UTC)
pv.SetDeletionTimestamp(&deleteTime)
result = append(result, pv)
}
return result
}
// newClaim returns a new claim with given attributes
func newClaim(name, claimUID, capacity, boundToVolume string, phase v1.PersistentVolumeClaimPhase, class *string, annotations ...string) *v1.PersistentVolumeClaim {
fs := v1.PersistentVolumeFilesystem