Skip to content

Instantly share code, notes, and snippets.

@samirbehara-zz
Created June 24, 2018 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samirbehara-zz/a446680aa58eba467fe8babdfd7fd0f3 to your computer and use it in GitHub Desktop.
Save samirbehara-zz/a446680aa58eba467fe8babdfd7fd0f3 to your computer and use it in GitHub Desktop.
def test_to_list_all_namespaces(k8s_client):
ret = k8s_client.list_namespace()
nscount = len(ret.items)
print(nscount)
assert(nscount > 0)
# Iterate through all the namespaces in the K8s cluster and list it down
for item in ret.items:
print(item.metadata.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment