kubernetes-client / kubernetes-client/python

Configure default timeout for all API calls

Open
#1,961 30 comments 8 reactions 1 assignee Claimed by @yliaog View on GitHub
kind/feature lifecycle/stale
Dominant language
Python
Stars
7.7k
Forks
3.5k
Avg merge
1d 14h
Merged PRs (30d)
18

Description

**What is the feature and why do you need it**:
All API calls done through this client today goes through urllib3, where the timeout is default to set to None, this means infinite timeout and is a well known pitfall with urllib3. Lost connection attempts can get stuck waiting forever, with no retries being done to reestablish the connection.

[Quoting the requests-documentation](https://requests.readthedocs.io/en/latest/user/quickstart/#timeouts) which uses urllib3 under the hood:

> _Nearly all production code should use this parameter in nearly all requests. Failure to do so can cause your program to hang indefinitely:_

------

There is a `_request_timeout` kwargs argument that can be set on each api-call, but that is both tedious, easy to forget and not type-checked due to use of kwargs-dictionarly.

**Describe the solution you'd like to see**:
Similar to how `retries` is configured, `Configuration` should accept a timeout-argument, this can be forwarded into urllib3s poolmanager where it uses this timeout for all operations where an explicit timeout is not provided.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.