This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
With this PR, grm deletes PVCs belonging to StatefulSets, if the ManagedResource has
.spec.deletePersistentVolumeClaims=true
, when the corresponding StatefulSet is removed from the ManagedResource or the respective ManagedResource is deleted.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
One thing, I am not so sure about, how to do it properly (feedback/ideas would be appreciated):
In order to be able to cleanup PVCs belonging to a StatefulSet, after it has been deleted, I am saving the StatefulSet before deleting it (we need
.spec.selector
from it for deleting the PVCs) here:https://github.com/gardener/gardener-resource-manager/blob/8d73ce9bbabda106b24c5e5dc77efafffe3006fd/pkg/controller/managedresources/controller.go#L585-L595
However, if
DELETE statefulset
succeeds but any call during PVC cleanup fails, grm won't be able to delete the corresponding PVCs in the next retry, because it can't get the StatefulSet anymore and therefore doesn't know that it should still cleanup some PVCs.Things, I have already considered:
!=
object identity and we only store the objects' names in the MR status, not theuid
.Long story short, I have no solution/idea, how to properly deal with this scenario. Also, I am not sure, if it's even worth considering it, or if this feature should be rather seen as a "best-effort cleanup".
Release note: