kubernetes_asyncio.dynamic.discovery module
- class kubernetes_asyncio.dynamic.discovery.CacheDecoder(client, *args, **kwargs)
Bases:
JSONDecoder
- class kubernetes_asyncio.dynamic.discovery.CacheEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
Bases:
JSONEncoder- default(o)
Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o)
- class kubernetes_asyncio.dynamic.discovery.Discoverer(client: DynamicClient, cache_file: str | None = None)
Bases:
objectA convenient container for storing discovered API resources. Allows easy searching and retrieval of specific resources.
Subclasses implement the abstract methods with different loading strategies.
- abstract property api_groups
- async default_groups(request_resources: bool = False) dict[str, dict[str, dict[str, ResourceGroup]]]
- abstractmethod async discover()
- async get(**kwargs: Any) Resource
Same as search, but will throw an error if there are multiple or no results. If there are multiple results and only one is an exact match on api_version, that resource will be returned.
- async get_resources_for_api_version(prefix: str | None, group: str | None, version: str | None, preferred: bool) dict[str, list[Resource]]
returns a dictionary of resources associated with provided (prefix, group, version)
- async invalidate_cache() None
- async parse_api_groups(request_resources: bool = False, update: bool = False) dict
Discovers all API groups present in the cluster
- abstractmethod async search(prefix: str | None = None, group: str | None = None, api_version: str | None = None, kind: str | None = None, **kwargs: Any) list[Resource]
- property version: dict[str, Any]
- class kubernetes_asyncio.dynamic.discovery.EagerDiscoverer(client, cache_file)
Bases:
DiscovererA convenient container for storing discovered API resources. Allows easy searching and retrieval of specific resources.
All resources are discovered for the cluster upon object instantiation.
- property api_groups
list available api groups
- async discover()
- async search(prefix: str | None = None, group: str | None = None, api_version: str | None = None, kind: str | None = None, **kwargs: Any) list[Resource]
Takes keyword arguments and returns matching resources. The search will happen in the following order:
prefix: The api prefix for a resource, ie, /api, /oapi, /apis. Can usually be ignored group: The api group of a resource. Will also be extracted from api_version if it is present there api_version: The api version of a resource kind: The kind of the resource arbitrary arguments (see below), in random order
The arbitrary arguments can be any valid attribute for an Resource object
- update(resources)
- class kubernetes_asyncio.dynamic.discovery.LazyDiscoverer(client, cache_file)
Bases:
DiscovererA convenient container for storing discovered API resources. Allows easy searching and retrieval of specific resources.
Resources for the cluster are loaded lazily.
- property api_groups
- async discover()