-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exec command is parsing output if output looks like json #1032
Comments
cc @jiahuif |
The json parsing is done by python/kubernetes/client/api_client.py Line 242 in ccd3ce4
Essentially what it does is
and the result becomes a string representation of the dict This looks like a bug in the upstream code generator. The generated client should not try parsing the response when the payload isn't JSON and the response is of @tkinz27 could you file an issue in https://github.com/OpenAPITools/openapi-generator?
|
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The stream method by default decodes the payload. This convers JSON payloads to python representation which can't be parsed as JSON again. Avoiding the conversion requires that we call the buffering and reading functions on our own. Upstream bug report: kubernetes-client/python#1032
No fix or work-around 4 and a half years later? |
What happened (please include outputs or screenshots):
Working on creating a scale test where the test orchestrator will exec in each pod and run a curl command to verify the pod is in the expected state. The output of the curl is JSON.
The problem seems to be that the stream client will parse the json as a python dictionary if the output is only json, but return it to the caller as a stringified dictionary. Expecting json,
json.loads
is failing.To verify I ran
What you expected to happen:
I really did not expect the response to be different depending on the output of the command being run.
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
We are able to get around the issue by adding
_preload_content=False
to thestream
function call and handling waiting for the response and reading stdout/stderr ourselves.I wasn't sure where the rogue json parsing is happening, maybe in WSResponse class?
Environment:
kubectl version
):Ubuntu 19.10
python --version
)pip list | grep kubernetes
)The text was updated successfully, but these errors were encountered: