in src/hyperpod_cli/clients/kubernetes_client.py [0:0]
def list_pods_in_all_namespaces_with_labels(self, label_selector: str):
v1Client = client.CoreV1Api()
pods = []
_continue = None
while True:
response = v1Client.list_pod_for_all_namespaces(
label_selector=label_selector,
limit=200, # Set a reasonable limit
_continue=_continue,
)
pods.extend(response.items)
_continue = response._metadata._continue # Get the continue token
if not _continue: # If there's no more data, break the loop
break
return pods