Skip to content

Commit

Permalink
Make getting resource by name more efficient by using a field select…
Browse files Browse the repository at this point in the history
…or (#452)
  • Loading branch information
catdog2 authored Sep 9, 2024
1 parent 75d5ace commit b67ae8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ cython_debug/

docs/autoapi/
_version.py

# Jetbrains IDEs
.idea/
6 changes: 5 additions & 1 deletion kr8s/_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ async def get(
if name:
try:
resources = await api.async_get(
cls, name, namespace=namespace, **kwargs
cls,
name,
namespace=namespace,
field_selector={"metadata.name": name},
**kwargs,
)
except ServerError as e:
if e.response and e.response.status_code == 404:
Expand Down

0 comments on commit b67ae8d

Please sign in to comment.