exec command is parsing output if output looks like json
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Comece pelo ponto de entrada do stream usado com connect_get_namespaced_pod_exec e, em seguida, inspecione a classe WSResponse e o caminho _preload_content mencionado no relatório. Reproduza os dois comandos echo e compare os valores retornados; considera-se concluído quando a saída do comando é retornada de forma consistente, para que a saída JSON possa ser passada para json.loads sem tratamento especial.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
In [5]: cmd=["echo", '{"example":"json", "with":null, "and":true}']
In [6]: kstream.stream(api_instance.connect_get_namespaced_pod_exec,
...: name=pod,
...: namespace=ns,
...: container=container,
...: command=cmd,
...: stderr=True,
...: stdin=False,
...: tty=False,
...: stdout=True)
Out[6]: "{'example': 'json', 'with': None, 'and': True}"
In [7]: cmd=["echo", 'but not actually json {"example":"json", "with":null, "and":true}']
In [8]: kstream.stream(api_instance.connect_get_namespaced_pod_exec,
...: name=pod,
...: namespace=ns,
...: container=container,
...: command=cmd,
...: stderr=True,
...: stdin=False,
...: tty=False,
...: stdout=True)
Out[8]: 'but not actually json {"example":"json", "with":null, "and":true}\n'
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 the stream 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:
- Kubernetes version (
kubectl version):
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.6", GitCommit:"7015f71e75f670eb9e7ebd4b5749639d42e20079", GitTreeState:"clean", BuildDate:"2019-11-19T15:41:24Z", GoVersion:"go1.12.13", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.8-eks-b8860f", GitCommit:"b8860f6c40640897e52c143f1b9f011a503d6e46", GitTreeState:"clean", BuildDate:"2019-11-25T00:55:38Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}
- OS (e.g., MacOS 10.13.6):
Ubuntu 19.10 - Python version (
python --version)
python 3.7.5
- Python client version (
pip list | grep kubernetes)
kubernetes==10.0.1
- Linguagem predominante
- Python
- Estrelas
- 7.7k
- Forks
- 3.5k
- Merge médio
- 1d 5h
- PRs com merge (30d)
- 23
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de kubernetes-client/python
-
getheaders is deprecated in urllib3 >= 2.0.0Talvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Abertakind/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
kubernetes-client/python#2280 · 18 comentários · 9 reações ·
Mantenedores costumam responder em até 1 dia
-
Make async an extraAbertakind/feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 55/100
kubernetes-client/python#2739 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Growing library sizeAbertahelp wanted
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
kubernetes-client/python#2677 · 15 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Add option to disable strict x509 verifcation in sync clientTalvez já em andamento @Vishwa0223 assumiu há 58 dias. Abertahelp wanted kind/feature
kubernetes-client/python#2602 · 6 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
v36.0.0 regression fetching container logsTalvez livre de novo @yliaog assumiu há 96 dias e não há nenhum pull request aberto. Abertakind/bug
kubernetes-client/python#2596 · 19 comentários · 2 reações · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de kubernetes-client/python
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 80/100
521xueweihan/HelloGitHub#4063 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Vanilla-OS/apx-gui#112 ·
-
Devstral and Voxtral: section 5 fails in us-east-1 with 400 "Model does not support audio modality"Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
aws-samples/sample-per-model-bedrock#409 ·
Mantenedores costumam responder em até 1 dia
-
DuckDB 2.0 breaks to_pyarrow_batchesTalvez já em andamento @DG47 assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
ibis-project/ibis#12196 ·
Mantenedores costumam responder em até 1 dia