Skip to content
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

ensure delete returns only when the delete operation is fully finished #3246

Closed
victornoel opened this issue Jun 16, 2021 · 4 comments
Closed

Comments

@victornoel
Copy link

victornoel commented Jun 16, 2021

Hi,

If I'm calling delete on a job for example, it takes time for the operation to really finish, but the delete call returns early, even if I used the FOREGROUND DeletionPropagation (not sure it's really linked to the matter ^^).

It would make sense to add an option so that the call only returns when everything is deleted as expected. A bit like the --wait parameter of kubectl works in that context (see kubernetes/kubernetes#42594).

@victornoel
Copy link
Author

Related to #1474

@victornoel
Copy link
Author

victornoel commented Jun 23, 2021

Potential workaround:

client.batch().v1().jobs()
    .inNamespace(namespace)
    .withName(name)
    .waitUntilCondition(Objects::isNull, 10, TimeUnit.SECONDS);

@manusa
Copy link
Member

manusa commented Jul 5, 2021

There's a different behavior between what the REST API does when performing a deletion with the foreground propagation policy and what kubectl does.

When you perform a kubectl delete ... --cascade='foreground, the command waits until every dependent resource is deleted to complete the execution.

However, when you perform the same operation using the REST API (with foreground PropagationPolicy), the requests returns as soon as the resource has been modified and the deletionTimestamp has been added to the metadata. I'm not sure if the client should take care of performing this wait/blocking for you.

Your suggestion is exactly what you need to do if you really need to provide blocking until the resource was effectively deleted.

@victornoel
Copy link
Author

@manusa I understand. It makes sense indeed, thank you for the explanation, I will continue with my solution then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants