Skip to content

v36.0.0 regression: core_api_instance.connect_get_node_proxy_with_path provide repr over bytes in responce #2623

Description

@penguinolog

What happened (please include outputs or screenshots):

In [16]: with kubernetes.client.ApiClient(kube_client_config) as api_client:
    ...:         core_api_instance = kubernetes.client.CoreV1Api(api_client)
    ...:         for source in SOURCES:
    ...:             try:
    ...:                 resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
    ...:             except kubernetes.client.exceptions.ApiException:
    ...:                 continue
    ...:             print(repr(resp[:10]))
    ...: 
"b'# HELP c"
"b'# HELP a"

What you expected to happen:

In [10]: with kubernetes.client.ApiClient(kube_client_config) as api_client:
    ...:         core_api_instance = kubernetes.client.CoreV1Api(api_client)
    ...:         for source in SOURCES:
    ...:             try:
    ...:                 resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
    ...:             except kubernetes.client.exceptions.ApiException:
    ...:                 continue
    ...:             print(repr(resp[:10]))
    ...: 
'# HELP con'
'# HELP agg'

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

from __future__ import annotations
import kubernetes
kube_client_config = kubernetes.client.Configuration()
KUBECONFIG="/root/.kube/config"
kubernetes.config.load_kube_config(config_file=KUBECONFIG, client_configuration=kube_client_config)
SOURCES = ("/metrics/resource", "/metrics/probe", "/metrics")
node="node001"  # use own hostname
with kubernetes.client.ApiClient(kube_client_config) as api_client:
         core_api_instance = kubernetes.client.CoreV1Api(api_client)
         for source in SOURCES:
             try:
                 resp = core_api_instance.connect_get_node_proxy_with_path(name=node, path=source)
             except kubernetes.client.exceptions.ApiException:
                 continue
             print(repr(resp[:10]))

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): v1.35.6
  • OS: Linux
  • Python version: 3.12
  • Python client version: 36.0.2
Rolling-back to v35.0.0 or using client generated by newer OpenApi generator fixes issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions