Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Executing command in pod fails when _request_timeout is passed in tuple format

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

Maintainer thường phản hồi trong vòng 3 ngày

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

Từ ngày 9/10/2024.

Đánh giá

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

Mô tả

help wanted kind/bug lifecycle/rotten

What happened (please include outputs or screenshots):

Executing command in pod fails if _request_timeout is passed as tuple.
The exact error is
Exception when calling CoreV1Api->connect_get_namespaced_pod_exec: (0) Reason: '<' not supported between instances of 'float' and 'tuple'

What you expected to happen:
Expected to run the command successfully.

How to reproduce it (as minimally and precisely as possible):

`from kubernetes import client, config
from kubernetes.stream import stream

def run_command_in_pod(namespace, pod_name, container_name, command, timeout):
config.load_kube_config()
c = client.Configuration()
c.debug = True
api_instance = client.CoreV1Api()

exec_command = [
    '/bin/sh',
    '-c',
    command
]

try:
    response = stream(api_instance.connect_get_namespaced_pod_exec,
                      pod_name,
                      namespace,
                      container=container_name,
                      command=exec_command,
                      stderr=True, stdin=False,
                      stdout=True, tty=False,
                      _request_timeout=timeout)
    print("Command output: ", response)
except client.exceptions.ApiException as e:
    print("Exception when calling CoreV1Api->connect_get_namespaced_pod_exec: %s\n" % e)

if name == 'main':
namespace = 'test'
pod_name = 'test'
container_name = 'test'
command = 'date'
timeout = (5, 10)

run_command_in_pod(namespace, pod_name, container_name, command, timeout)`

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): 1.30
  • OS (e.g., MacOS 10.13.6): Rocky 8.6
  • Python version (python --version) 3.9
  • Python client version (pip list | grep kubernetes) kubernetes-31.0.0
Ngôn ngữ chính
Python
Star
7.7k
Fork
3.5k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

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.