kube-object-storage / lib-bucket-provisioner

Library for the dynamic provisioning of object store buckets to be used by object store providers.
Apache License 2.0
20 stars 22 forks source link

lib should not cleanup for provisioners #151

Open jeffvance opened 5 years ago

jeffvance commented 5 years ago

Today the library calls the provisioner's Delete method in different situations but only for greenfield provisioning where the reclaim policy is "Delete"

  1. the OBC is deleted (most common)
  2. the provsioner returns a Provision error
  3. Provision is successful but the lib is unable to complete its job, eg. can't create the OB, secret or configmap (only for greenfield).

Note: assume Revoke is called for cleanup when Grant is called.

While proivisioners generally don't distinguish between these cases, the 3rd reason can likely be folded into the first since in both situations the provisioner knows the bucket was created and now it's being called to delete the bucket and related artifacts.

This issue addresses the 2nd case above. I propose that the lib should not call Delete when Provision returns an error. In this case provisioners should be expected to cleanup all artifacts that were created or altered before their Provision method returns.

Note: if this is implemented we will break all provisioners that rely on the lib to call their Delete method as one of the cleanup steps. This applies to all errors: those returned by Provision and those lib detected by the lib when it's creating resources.

@guymguym @nimrod-becker @copejon @screeley44