Skip to content
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

empty pod name leads to list pods for read namespaced pod endpoint #2382

Open
pratikmallya opened this issue Apr 7, 2025 · 1 comment
Open
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@pratikmallya
Copy link

pratikmallya commented Apr 7, 2025

What happened (please include outputs or screenshots):

When calling read_namespace_pod method with an empty string, we accidentally hit the list pods endpoint. This can cause unexpected behavior, such as OOMKills, if the number of pods in the cluster is very large.

What you expected to happen:
If an empty string is given, the client should always throw a 404

How to reproduce it (as minimally and precisely as possible):
set the log level of urllib3 to DEBUG

>>> logger = logging.getLogger("urllib3")
>>> logger.setLevel(logging.DEBUG)

then call the read_namespaced_pod method with an empty string. The log line looks like:

{"timestamp": "2025-04-07T06:16:11.008466+0000", "levelname": "debug", "filename": "connectionpool.py", "thread_name": "MainThread", "process": 602125, "lineno": 547, "message": "https://172.20.0.1:443 \"GET /api/v1/namespaces/dbt-cloud/pods/ HTTP/1.1\" 200 None",}

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version):
  • OS (e.g., MacOS 10.13.6):
  • Python version (python --version)
  • Python client version (pip list | grep kubernetes): 29.0.0
@pratikmallya pratikmallya added the kind/bug Categorizes issue or PR as related to a bug. label Apr 7, 2025
@yliaog
Copy link
Contributor

yliaog commented Apr 9, 2025

this works as expected, the k8s API server returns the list of pods for the following API request:

GET https://server_IP/api/v1/namespaces/default/pods

@yliaog yliaog self-assigned this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants