Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Last active December 15, 2021 10:31
Show Gist options
  • Save velotiotech/f4b7aec6da33ffb924dccc47358718f0 to your computer and use it in GitHub Desktop.
Save velotiotech/f4b7aec6da33ffb924dccc47358718f0 to your computer and use it in GitHub Desktop.
v1.list_namespace()
"""
returns a JSON with all the info like spec, metadata for each namespace
For eg:
{'api_version': 'v1',
'items': [{'api_version': None,
'kind': None,
'metadata': {'annotations': None,
'cluster_name': None,
'creation_timestamp': datetime.datetime(2021, 2, 11, 11, 29, 32, tzinfo=tzutc()),
'deletion_grace_period_seconds': None,
'deletion_timestamp': None,
'finalizers': None,
'generate_name': None,
'generation': None,
'labels': None,
'managed_fields': [{'api_version': 'v1',
'fields_type': 'FieldsV1',
'fields_v1': {'f:status': {'f:phase': {}}},
'manager': 'kube-apiserver',
'operation': 'Update',
'time': datetime.datetime(2021, 2, 11, 11, 29, 32, tzinfo=tzutc())}],
'name': 'default',
'namespace': None,
'owner_references': None,
'resource_version': '199',
'self_link': None,
'uid': '3a362d64-437d-45b5-af19-4af9ae2c75fc'},
'spec': {'finalizers': ['kubernetes']},
'status': {'conditions': None, 'phase': 'Active'}}],
'kind': 'NamespaceList',
'metadata': {'_continue': None,
'remaining_item_count': None,
'resource_version': '69139',
'self_link': None}}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment