kr8s-org / kr8s

A batteries-included Python client library for Kubernetes that feels familiar for folks who already know how to use kubectl
https://kr8s.org
BSD 3-Clause "New" or "Revised" License
839 stars 45 forks source link

Make Api.get() use server side filtering #486

Open jacobtomlinson opened 2 months ago

jacobtomlinson commented 2 months ago

Which project are you requesting an enhancement for?

kr8s

What do you need?

In #452 we made APIObject.get() more efficient by side server side filtering.

It would be nice if we could make the same improvement to Api.get(). For example:

import kr8s

pod1, pod2 = kr8s.get("Pod", "pod1", "pod2")

In the above example we list all pods, and then filter out just pod1 and pod2. It would be much more efficient to do the filtering on the server side. In #452 we used a field selector to do this, however it looks like it's not possible to do that for multiple resources as it doesn't support the in operator.

Looking at kubectl get pods pod1 pod2 it appears to make two get requests and does server side filtering on each one so that each request only returns one Pod. We probably want to replicate this pattern in kr8s.

TanyaKansal commented 1 month ago

@jacobtomlinson can I work on this issue?

jacobtomlinson commented 1 month ago

@TanyaKansal Sure!

TanyaKansal commented 1 month ago

@jacobtomlinson please assign to me. Also can you plz add hacktoberfest label to it?

jacobtomlinson commented 1 month ago

Thanks for the enthusiasm! We don't assign issues here as it can block other folks from picking it up if you don't manage to get around to it. Please consider the issue yours. The whole repo has the hactoberfest label so we shouldn't need to label individual issues.

To anyone else reading this if more than two weeks have passed and no PR has been raised to close this then consider it available again.