Open UPADHYA28 opened 1 year ago
You can set compositeDeletePolicy: Foreground
in the claim or defaultCompositeDeletePolicy: Foreground
in the XRD to get the behavior you are looking for.
https://docs.crossplane.io/v1.12/concepts/composition/#hl-4-20
https://docs.crossplane.io/v1.12/concepts/composition/#hl-6-30
@bobh66 Thank you for providing this detail. I tried with this and it works for me by using defaultCompositeDeletePolicy
configuration. But the observation what i made is, if my composition has multiple MRs (lets say 5). And on delete triggered on claim deletes 3 MR and other 2 failed to get cleaned (due to some blocker lets say admission webhook rejection). In this scenario claim still says "Synce" and "Ready" values as True
And no where traces found which resources is failed to cleaned up!
You can use the lineage tool - https://tohjustin.github.io/posts/2021-11-01-kube-lineage/ - to examine the composite resource status and find the resources that are stuck deleting.
Looks like the original intent of this issue is solved by @bobh66 suggestion to use compositeDeletePolicy: Foreground
, but there may be some lingering experience issues with the claim still reporting ready: true
even though some of its composed resources are already gone.
I'll update the title to reflect that potential experience issue and then add this as an issue to consider for the developer experience epic #3957
Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale
because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh
will mark this issue as not stale.
Still hearing reports of this from the community, so re-opening and clarifying that the remaining issue seems to be what is described in https://github.com/crossplane/crossplane/issues/4165#issuecomment-1590745721
Crossplane does not currently have enough maintainers to address every issue and pull request. This issue has been automatically marked as stale
because it has had no activity in the last 90 days. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh
will mark this issue as not stale.
/fresh
What happened?
edit: the remaining behavior still impacted appears to be https://github.com/crossplane/crossplane/issues/4165#issuecomment-1590745721
Original issue:
I had a Claim, XR, Composition, and Composition generated MR. If I delete the claim it was expected to wait till MR gets removed from the system(as owner ref is there and block owner delete option is set true on MR). But in my case MR could not be get removed (due to some issue, let's say some custom webhook validating my MR rejected the Delete req) but claim and XR got delete from the system. Is this expected behavior (by looking at owner ref values it doesn't seem to be)
How can we reproduce it?
Create a Claim and using the composition generate the MR. Have some external webhook which validates the delete req for MR and make your MR delete req rejected always.
Now delete the claim. You can expect claim and XR got removed but MR is still there in the system (Due to webhook rejection). I was expecting since MR is not deleted, XR also will not be removed from the system and the webhook error would be updated back to XR.
What environment did it happen in?
Crossplane version: latest