-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
kubectl delete should wait for resource to be deleted before returning #42594
Comments
I'd probably want StatusDetails should probably have a UID field, but there's a question of how much detail want to to put in there. I don't want to add UID, then come back later and have to add other fields like resourceVersion, deletionTimestamp, etc. |
Perhaps More of a semantic question: is there a specific reason to send DELETEs with a precondition, instead of repeated GET/HEADs? Not sure if the latter is possible since I haven't worked much with the apiserver, but that's how SDKs usually implement logic like this. |
The current state is that kubectl delete always waits (for ex: it waits for pods to be deleted when running
It may only have access to run DELETE requests and hence wont be able to run GET. |
/subscribe |
Automatic merge from submit-queue Enable secrets in federation kubectl tests Fixes #40568 Superseedes #40714 Updating kubectl tests to wait for deletion if WAIT_FOR_DELETION is set to true. WAIT_FOR_DELETION will be set to true only when the tests are being run for federation apiserver. This change will not impact kube apiserver tests and still enable federation and kubernetes to share the same test code. This is a workaround until #42594 is fixed. cc @kubernetes/sig-federation-pr-reviews cc @liggitt as he reviewed #40714
Sent #45600 to add UID. Happy to add other fields if required. |
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658) Updating generic registry to return UID of the deleted resource Ref #42594 cc @kubernetes/sig-api-machinery-pr-reviews @smarterclayton ```release-note Updating apiserver to return UID of the deleted resource. Clients can use this UID to verify that the resource was deleted or waiting for finalizers. ```
Sent #46471 which updates kubectl to wait for deletion by default and adds a |
Automatic merge from submit-queue Deleting kubectl.ServiceReaper since there is no special service deletion logic Ref #46471 #42594 ServiceReaper does not have any special deletion logic so we dont need it. The generic deletion logic should be enough. By removing this reaper, service deletion also gets the new wait logic from #46471 cc @kubernetes/sig-cli-misc
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658) Updating generic registry to return UID of the deleted resource Ref kubernetes/kubernetes#42594 cc @kubernetes/sig-api-machinery-pr-reviews @smarterclayton ```release-note Updating apiserver to return UID of the deleted resource. Clients can use this UID to verify that the resource was deleted or waiting for finalizers. ```
any updates? |
@nikhiljindal could this be related ? |
@Blasterdick No this is not related. Jianhuiz pointed out the root cause for that in: #53566 (comment). Its a bug in federation deployment controller. Doesnt require any change to kubectl. Unassigning since am not working actively on this anymore. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@nikhiljindal I disagree with this statement for a couple reasons:
Example: I added a custom finalizer
e.g. 7 minutes later:
|
@nikhiljindal your PR #46471 (adding a |
No. Feel free to take over. |
/remove-lifecycle stale |
This is driving me up the wall. I may get to this before too long. |
is this fixed by #64034? |
Guys, it's not a good idea to break current behaviour. By default delete command was not waiting until everything will be complete. I have a lot of scripts that drop a lot of resources. Now they are working for a very long time. Wait feature is good, but default behaviour change is upsetting |
@nekufa add |
@roffe sure, i found how to achieve this, thank you. |
Why was this made default? I cannot find any rationale for this here. IMO, one should have very good reason to break current behaviour. Besides, while I agree that this is a good addition, there are still plenty of use cases for not waiting. |
Yikes - was wondering why delete seems to now hang. Now I know! IMO a bad choice for the default behaviour :( |
What is actually going on under the covers? It appears that the command immediately prints " deleted" and then hangs, but actually it is waiting. It seems like the messaging is incorrect. It should say "deleting" and if --wait is the default it should only print "deleted" when the object is actually deleted. The way it works right now it seems like kubectl deletes things and then hangs for no reason, and it doesn't give any indication that a state change has actually happened when the command finally terminates. (However ctrl-c and inspecting with kubectl get shows what is going on.) It's also a little surprising that the whole operation is async and ctrl-c doesn't stop it.) |
I don't know if it could be more clear that it's async by saying "queued for deletion" or "scheduled for deletion." followed by saying "waiting for controller to report deletion" or something and finally "controller reports resource is deleted." |
I do think this is good default behavior it just needs better messaging. |
After deleting all the resources in the test namespace, check if some DaemonSet is still in place. This check is useful because the k8s delete APIs are asynchronous. See kubernetes/kubernetes#42594 for more detailed information. Signed-off-by: Andrea Panattoni <[email protected]>
After deleting all the resources in the test namespace, check if some DaemonSet is still in place. This check is useful because the k8s delete APIs are asynchronous. See kubernetes/kubernetes#42594 for more detailed information. Signed-off-by: Andrea Panattoni <[email protected]>
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658) Updating generic registry to return UID of the deleted resource Ref kubernetes/kubernetes#42594 cc @kubernetes/sig-api-machinery-pr-reviews @smarterclayton ```release-note Updating apiserver to return UID of the deleted resource. Clients can use this UID to verify that the resource was deleted or waiting for finalizers. ``` Kubernetes-commit: a4307eb7a238cbda1cc1d6573336a1a7634b0db9
As per #40714 (comment),
kubectl delete
should ensure that the resource is deleted before returning by default. We can also add a--wait-for-deletion
flag that users can set if they dont want to wait.Work items:
--wait-for-deletion=false
.cc @liggitt @smarterclayton @bgrant0607 @kubernetes/sig-cli-bugs
The text was updated successfully, but these errors were encountered: