ignore ReclaimPolicy in provisioner Delete implementation
let the library decide if deletion is necessary.
warn if ob has a ReclaimPolicy != Delete
@@ -163,14 +163,16 @@ func (p *Provisioner) Delete(ob *nbv1.ObjectBucket) error {
log.Infof("Delete: got request to delete bucket %q and account %q", r.BucketName, r.AccountName)
- if ob.Spec.ReclaimPolicy != nil &&
- (*ob.Spec.ReclaimPolicy == corev1.PersistentVolumeReclaimDelete ||
- *ob.Spec.ReclaimPolicy == corev1.PersistentVolumeReclaimRecycle) {
+ if ob.Spec.ReclaimPolicy != nil && *ob.Spec.ReclaimPolicy != corev1.PersistentVolumeReclaimDelete {
+ // if reclaim policy is not delete, just warn and continue with deletion.
+ // we still want to delete because this could be part of resources cleanup after failed provisioning
+ log.Warnf("got delete request but reclaim policy is not Delete. assuming this is cleanup after error. ob.Spec.ReclaimPolicy=%q", *ob.Spec.ReclaimPolicy)
+ }
+
err = r.DeleteBucket()
if err != nil {
return err
}
- }
err = r.DeleteAccount()
if err != nil {
