This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
Convert client wrappers to coroutines, use thread pools for actual calls #217
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
The client wrappers are used to isolate the framework's reactor from the specific HTTPS API calls needed to talk to Kubernetes, and from the ways of doing so. They provide a limited set of operations needed only, and no more than that (no general-purpose DSL for resource manipulation).
In this PR, all remaining synchronous client wrappers are converted to async coroutines, while they remain Pykube-based internally (
pykube-ng
is synchronous, asrequests
are synchronous).This is needed both for the switch to aiohttp (e.g. #176), and for the re-authentication activities (few issues).
The synchronous calls are moved few levels down the stack, and put into the thread-pool executors.
Previously, these calls were sync inside of the async event loop, so they were blocking. It was not a big problem, as most of them are executed only once or twice per run in the very beginning; the frequent resource-watching & resource-patching & event-posting calls were already executed in the thread pools. But it now becomes a problem since all API calling methods cannot be so diverse anymore, and have to be uniform (specifically, async).
Types of Changes