Support _request_timeout in dynamic client watch()

Đang mở
#2,533 5 bình luận 0 reaction 1 người được giao Xem trên GitHub

@Polimixanos đang làm issue này rồi.

Từ ngày 23/4/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

kind/feature

Problem

When using the dynamic client’s watch() method:

api = self._client.resources.get(
    api_version=self._api_version,
    kind=self._kind
)

for event in api.watch(
    timeout=server_timeout_seconds,
)

there is currently no way to configure a client-side request timeout (_request_timeout).

Current Workaround

To enforce a client-side timeout, we have to bypass Resource.watch() and directly use Watch().stream():

for raw_event in Watch().stream(
    api.get,
    serialize=False,
    deserialize=False,
    timeout_seconds=self._server_timeout_seconds,
    _request_timeout=self._client_timeout_seconds,
)

Issue

The dynamic client’s watch() method internally relies on Watch().stream() but does not expose _request_timeout as a parameter: https://github.com/kubernetes-client/python/blob/master/kubernetes/base/dynamic/client.py#L203

This creates:
Inconsistent API ergonomics
Unnecessary duplication of logic for users needing client-side timeouts

Proposed Solution

Extend Resource.watch() to accept an optional _request_timeout parameter and pass it through to the underlying Watch().stream() call.

Example:

api.watch(
    timeout=server_timeout_seconds,
    _request_timeout=(connect_timeout, read_timeout),
)
Ngôn ngữ chính
Python
Star
7.7k
Fork
3.5k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
18

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của kubernetes-client/python

Tất cả issue của kubernetes-client/python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.