pod_exec() yields inconsistent results
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Comienza con examples/pod_exec.py, especialmente con la llamada de stream que usa connect_get_namespaced_pod_exec y run_forever(), y luego reproduce el comando repetidamente con las versiones indicadas de Kubernetes y del cliente. Traza cómo el stream informa del estado y returncode de channel 3; se considera terminado cuando un comando fallido informa de forma consistente del estado NonZeroExit en lugar de alternar entre éxito y fallo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened (please include outputs or screenshots):
I'm trying to implement this code sample: https://github.com/kubernetes-client/python/blob/master/examples/pod_exec.py#L69-L82
But running multiple times the same command returns different results.
What you expected to happen:
I'm expecting all command execution to return the same result
How to reproduce it (as minimally and precisely as possible):
Create a test.py
from kubernetes import client, config
from kubernetes.stream import stream
config.load_kube_config()
r = stream(client.CoreV1Api().connect_get_namespaced_pod_exec, name='mypod', namespace='default',
container='mgmt', command=['false'], stderr=True, stdin=False, stdout=True, tty=False,
_preload_content=False)
r.run_forever()
print(vars(r))
print(r.returncode)
Run it multiple times:
$ for i in {1..10}; do python test.py; sleep 2; done
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x103325840>, 'sock': <websocket._core.WebSocket object at 0x103364d70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x105c89840>, 'sock': <websocket._core.WebSocket object at 0x105cc8d70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x104ead840>, 'sock': <websocket._core.WebSocket object at 0x104eecd70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x103115840>, 'sock': <websocket._core.WebSocket object at 0x103154d70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x1079cd840>, 'sock': <websocket._core.WebSocket object at 0x107a0cd70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"command terminated with non-zero exit code: command terminated with exit code 1","reason":"NonZeroExitCode","details":{"causes":[{"reason":"ExitCode","message":"1"}]}}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x105019840>, 'sock': <websocket._core.WebSocket object at 0x105058d70>, '_returncode': None}
1
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x10742d840>, 'sock': <websocket._core.WebSocket object at 0x107468d70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x105dcd840>, 'sock': <websocket._core.WebSocket object at 0x105e08d70>, '_returncode': None}
0
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"command terminated with non-zero exit code: command terminated with exit code 1","reason":"NonZeroExitCode","details":{"causes":[{"reason":"ExitCode","message":"1"}]}}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x105ae5840>, 'sock': <websocket._core.WebSocket object at 0x105b24d70>, '_returncode': None}
1
{'_connected': False, '_channels': {3: '{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Success"}\n'}, 'binary': False, 'newline': '\n', '_all': <_io.StringIO object at 0x1076a5840>, 'sock': <websocket._core.WebSocket object at 0x1076e4d70>, '_returncode': None}
0
All those runs should return a NonZeroExit status.
Anything else we need to know?:
Environment:
- Kubernetes version (
kubectl version): Client Version: v1.28.13
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.11 - OS (e.g., MacOS 10.13.6): MacOS Sequoia 15.2
- Python version (
python --version): Python 3.13.1 - Python client version (
pip list | grep kubernetes): kubernetes 31.0.0
- Lenguaje dominante
- Python
- Estrellas
- 7.7k
- Forks
- 3.5k
- Merge medio
- 2 d 5 h
- PR fusionados (30 d)
- 24
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de kubernetes-client/python
-
kind/bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
kubernetes-client/python#2280 · 16 comentarios · 9 reacciones ·
Los mantenedores suelen responder en 1 día
-
Release 1.37Quizá libre de nuevo @yliaog la tomó hace 29 días y no hay ningún pull request abierto. Abierto
kubernetes-client/python#2691 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Growing library sizeAbiertohelp wanted
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
kubernetes-client/python#2677 · 13 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Add option to disable strict x509 verifcation in sync clientQuizá libre de nuevo @Vishwa0223 la tomó hace 33 días y no hay ningún pull request abierto. Abiertohelp wanted kind/feature
kubernetes-client/python#2602 · 6 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
v36.0.0 regression fetching container logsQuizá libre de nuevo @yliaog la tomó hace 72 días y no hay ningún pull request abierto. Abiertokind/bug
kubernetes-client/python#2596 · 13 comentarios · 2 reacciones · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de kubernetes-client/python
Issues similares
-
pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pydantic/pydantic-ai#8843 ·
Los mantenedores suelen responder en 1 día
-
breaking change enhancement server
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
sktime/sktime#11310 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día