-
Notifications
You must be signed in to change notification settings - Fork 309
feat: Implement lifecycle management with Finalizers and OwnerReferences (Issue #789) #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Implement lifecycle management with Finalizers and OwnerReferences (Issue #789) #987
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shivansh-gohem The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @shivansh-gohem. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| mark.KindReady(crd.Status.AcceptedNames.Kind) | ||
| } | ||
|
|
||
| // TODO: the context that is passed here is tied to the reconciliation of the rgd, we might need to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not have been removed
905914d to
8566f94
Compare
8566f94 to
447371a
Compare
- Remove unclear FIX comments per review feedback - Restore TODO comment about context decoupling - Rename finalizer to descriptive kro.run/cleanup - Implement instance cleanup grace period for issue 789 - Wait for all instances to be deleted before finalizer removal BREAKING CHANGE: Finalizer renamed to kro.run/cleanup
447371a to
ad5fcd6
Compare
|
Hi @jakobmoellerdev , Thank you for the detailed review feedback! I've addressed all your comments and cleaned up the code!! I want to be transparent - I use AI assistance primarily for text formatting, documentation, and understanding patterns in the codebase. Will not repeat further mistake in future. |
jakobmoellerdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this feature is still controversial in the community, it is okay from an implementation perspective.
The issue still lies in the fact that deletion of CRDs is considered by many to be too dangerous to happen during cleanup. If you want to bring your point and get it merged, we will need to agree here with at least 2 other maintainers to back this.
I will be transparent here and say that it it will be hard to push it through without considering any of the tradeoffs in the ADR.
/cc @a-hilaly
|
i had now idea this was being worked on. /hold |
|
Hi @jakobmoellerdev and @a-hilaly , I think there might be some confusion about what this PR does. Let me clarify: What This PR Does ✅ (i)Adding a finalizer (kro.run/cleanup) to RGDs The Problem This Solves (i)The microcontroller shuts down immediately After This PR This is purely about instance lifecycle management, not CRD deletion policy. The implementation follows standard Kubernetes finalizer patterns. Happy to discuss the approach or make any changes needed. |
This PR implements the lifecycle management logic described in KREP-004 to resolve #789.
Note: This PR supersedes #959. I apologize for the noise on the previous PR; I encountered git history corruption while rebasing onto the new v0.8.0 changes and decided a clean branch was the safest path to ensure no legacy commits were lost.
Changes
SetOwnerReferenceswhen creating CRDs. This ensures Kubernetes Garbage Collection automatically cleans up CRDs (and their instances) when an RGD is deleted.kro.run/finalizerto RGDs. This blocks deletion until the controller has successfully run its cleanup logic.pkg/grapharchitecture (migrated from removed methods likeGetCRD()/GetDependencies()to the new.Metafield structure).Implementation Details
handleFinalizerhelper incontroller_reconcile.goto manage the finalizer lock.Reconcileloop incontroller.goto handle the deletion timestamp and ensure cleanup runs before removing the finalizer.crdgeneration to useruntime.DefaultUnstructuredConvertersinceGetCRD()was removed in the recent refactor.Verification
make lintpassed.make testpassed.kro.run/finalizerattached.Closes #789