fix #4516: adding a blocking delete operation #4578
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4516 with the ability to make delete a blocking operation.
The context changes are due to elevating timeout to the base context. To avoid multiple inheritance issues with Timeoutable it was converted to non-generic.
This option turns out to be a lot simpler than adding the force option to serverSideApply and replace - as all of the delete options (timeout, grace period, propagation) are needed for those contexts as well. And we just introduced a NonDeletingOperation interface which further complicates what could be common api point for specifying delete options.
The blocking delete is similar to what exists in the kubectl client when --wait is used as a parameter (delete, apply, replace). The returned statusdetails are used to determine the set of uids that you're tracking. Once none of those exist, you'll consider things deleted. A corner case is the possibility of incomplete statusdetails - that was noted in an old issue, but I'm not sure that it is still relevant and kubectl doesn't consider that case either.
This simplifies the workaround to just two calls:
op.withTimeout(10, TimeUnit.SECONDS).delete();
op.create();
This is also applicable to #3246 and similar issues.
Type of change
test, version modification, documentation, etc.)
Checklist