Skip to content

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

Open
@pratikmallya

Description

@pratikmallya

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

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions