in src/hyperpod_cli/service/get_namespaces.py [0:0]
def get_namespaces(self, label_selector=None):
"""
Get namespaces in the cluster
"""
core_v1_api = KubernetesClient().get_core_v1_api()
all_namespaces = list()
continue_token = None
while True:
response = None
if continue_token:
response = core_v1_api.list_namespace(
limit=LIMIT_PER_REQUEST, label_selector=label_selector, _continue=continue_token
)
else:
response = core_v1_api.list_namespace(
limit=LIMIT_PER_REQUEST, label_selector=label_selector
)
all_namespaces.extend([ns.metadata.name for ns in response.items])
continue_token = response.metadata._continue
if not continue_token:
break
return all_namespaces