Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Python kubernetes client breaks when parsing the response from custom controller #139

@ccamacho

Description

@ccamacho

Issue: Python kubernetes client breaks when parsing the response from custom controller

When running a watch primitive as:
resource_version = ''
while True:
stream = watch.Watch().stream(crds.list_cluster_custom_object, DOMAIN, "v1", "guitars", resource_version=resource_version)

The python client breaks with:

Traceback (most recent call last):
File "controller-pods.py", line 39, in
for event in stream:
File "/usr/lib/python2.7/site-packages/kubernetes/watch/watch.py", line 154, in stream
for line in iter_resp_lines(resp):
File "/usr/lib/python2.7/site-packages/kubernetes/watch/watch.py", line 60, in iter_resp_lines
resp = resp.read_chunked(decode_content=False)
AttributeError: 'HTTPResponse' object has no attribute 'read_chunked'

Packages versions:
rpm -qf /usr/lib/python2.7/site-packages/openshift/dynamic/client.py /usr/lib/python2.7/site-packages/kubernetes/watch/watch.py

python2-openshift-0.8.8-1.el7.noarch
python2-kubernetes-8.0.1-1.el7.noarch

Workaround, it seems that in this case the response does not allow to be chunked, using instead **read() in[1]:

https://github.com/kubernetes-client/python-base/blob/master/watch/watch.py#L48

Before:
for seg in resp.read_chunked(decode_content=False):
After:
for seg in resp.read():

Seemed to work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions