- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.6k
KEP-5673: add Graceful Deletion support for Custom Resources #5674
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: master
Are you sure you want to change the base?
Conversation
This KEP proposes adding support for graceful deletion to Custom Resources (CRs) by honoring the `--grace-period` flag (and `DeleteOptions.GracePeriodSeconds`) during deletion operations. Currently, when users delete a Custom Resource with a specified grace period, the value is ignored, leading to unexpected behavior for controllers and operators that rely on finalizers and graceful shutdown logic. This enhancement will ensure that when a Custom Resource is deleted with a grace period, the `metadata.deletionGracePeriodSeconds` field is properly set, allowing finalizers to observe this value and implement appropriate graceful shutdown behavior. This KEP proposes implementing this as stable behavior without a feature gate, as the change is purely additive, backward compatible, and poses minimal risk. Signed-off-by: Daniel Sionov <dsionov@redhat.com>
| Welcome @dasionov!  | 
| Hi @dasionov. Thanks for your PR. I'm waiting for a github.com 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. Instructions 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. | 
| [APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dasionov The full list of commands accepted by this bot can be found here. 
Needs approval from an approver in each of these files:
 Approvers can indicate their approval by writing  | 
| - Potential for confusion about when grace periods apply (only with finalizers) | ||
|  | ||
| ## Alternatives | ||
|  | 
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.
Could we achieve the same aim without any in-tree code? If so, I recommend listing that as one of the alternatives.
|  | ||
| **Decision**: Rejected. Grace periods should only apply when there's work to do | ||
| (i.e., finalizers present), consistent with Pod behavior. | ||
|  | 
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.
How I'd implement grace period for custom resources? A CEL expression that maps a requested grace period to a decision:
- nope, no grace period
- the actual grace period (eg: clamped to 60 second minimum)
Does that seem feasible? The expression would be part of the CustomResourceDefinition API.
Add support for graceful deletion of Custom Resources by honoring --grace-period and setting metadata.deletionGracePeriodSeconds.