Skip to content

Commit

Permalink
Upgrade kubectl-ng get to the new async syntax (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Dec 18, 2024
1 parent 537de43 commit b2baa35
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/kubectl-ng/kubectl_ng/_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from rich.live import Live

import kr8s
from kr8s._async_utils import anext
from kr8s.asyncio.objects import Table

TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
Expand Down Expand Up @@ -49,11 +50,13 @@ async def draw_table(kind, response, resource_names):
async def get_resources(resources, label_selector, field_selector):
data = {}
for kind in resources:
data[kind] = await kr8s.asyncio.get(
kind,
label_selector=label_selector,
field_selector=field_selector,
as_object=Table,
data[kind] = await anext(
kr8s.asyncio.get(
kind,
label_selector=label_selector,
field_selector=field_selector,
as_object=Table,
)
)
return data

Expand Down

0 comments on commit b2baa35

Please sign in to comment.