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
Fixes grace period in delete #48582
Fixes grace period in delete #48582
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fabianofranz No associated issue. Update pull-request body to add a reference to an issue, or get approval with The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/sig cli |
14e9208
to
58da0c0
Compare
/test pull-kubernetes-kubemark-e2e-gce |
@@ -289,7 +289,7 @@ func ReapResult(r *resource.Result, f cmdutil.Factory, out io.Writer, isDefaultD | |||
return nil | |||
} | |||
|
|||
func DeleteResult(r *resource.Result, out io.Writer, ignoreNotFound bool, shortOutput bool, mapper meta.RESTMapper) error { | |||
func DeleteResult(r *resource.Result, out io.Writer, ignoreNotFound bool, gracePeriod int, shortOutput bool, mapper meta.RESTMapper) error { |
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.
the int type is strange. At least document here what it means.
@@ -302,7 +302,12 @@ func DeleteResult(r *resource.Result, out io.Writer, ignoreNotFound bool, shortO | |||
|
|||
// if we're here, it means that cascade=false (not the default), so we should orphan as requested | |||
orphan := true | |||
return deleteResource(info, out, shortOutput, mapper, &metav1.DeleteOptions{OrphanDependents: &orphan}) | |||
options := &metav1.DeleteOptions{} | |||
if gracePeriod >= 0 { |
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.
> 0
should be enough
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.
In fact 0 is a valid value, only negatives are ignored.
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.
Didn't notice that DeleteOptions.GracePeriodSeconds
is a pointer. Then it makes a difference indeed.
lgtm, aside from maybe adding a small test |
58da0c0
to
d772956
Compare
/retest Review the full test history for this PR. |
/retest Review the full test history for this PR. |
3 similar comments
/retest Review the full test history for this PR. |
/retest Review the full test history for this PR. |
/retest Review the full test history for this PR. |
Automatic merge from submit-queue |
@fabianofranz: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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/test-infra repository. I understand the commands that are listed here. |
What this PR does / why we need it: Fixes
kubectl delete
ignoring--grace-period
.Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes openshift/origin#15060 found in OpenShift.Release note: