acorn-io / runtime

A simple application deployment framework built on Kubernetes
https://docs.acorn.io/
Apache License 2.0
1.14k stars 102 forks source link

Fix: add logic to update volume reclaim policy to delete #2479

Closed StrongMonkey closed 4 months ago

StrongMonkey commented 4 months ago

Checklist

Previously, we have set PV/PVC's claimpolicy to retain to intentionally keep PV around when user has deleted their app. This is to avoid PV gets deleted when PVC is deleted. However this exposes a problem that when the volume/PV is deleted from acorn, the underlying storage resource is not cleaned up because of retain policy. So, when acorn initialize a delete call, we tweak the PV's reclaim policy to be delete before we actually delete the resource. This makes sure the driver will clean up the PV and underlying storage resource.

The downside of this fix, is that we will switch every PV's claimpolicy to delete regardless of what it has been actually configured in the cluster, if you delete PV through acorn api.

https://github.com/acorn-io/manager/issues/1764