This repository has been archived by the owner on Oct 3, 2020. It is now read-only.
Pass arbitrary params to the watching GET queries #33
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.
GET
queries of K8s API can accept some params, which are especially needed for the watching GET-queries. These params are NOT the request body and not the payload, but the execution modes/flags.For example, for pod-watching: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#watch-64
The set of these params can change over time. To avoid mapping each and every one of them to pykube's codebase (and resolving the camelCase conventions to Python's snake_case), this PR adds
params
option towatch()
call — and passes them directly to the query params.For example, this script disables the socket timeouts, but asks the server to limit the query to 10s (server-side!). When the time runs out, the query ends normally, without any exceptions.
Whether or not such
params
should be added to other operations (e.g. listing), is a question to discuss. Most of the writing operations (patch, create, replace) only havepretty
param, which is useless; however,delete
hasgracePeriodSeconds
andpropagationPolicy
, which can be of use.