kubernetes.aio.dynamic.discovery module

class kubernetes.aio.dynamic.discovery.CacheDecoder(client, *args, **kwargs)

Bases: JSONDecoder

object_hook(obj)
class kubernetes.aio.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 a TypeError).

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.aio.dynamic.discovery.Discoverer(client, cache_file=None)

Bases: object

A 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=False)
abstractmethod discover()
async get(**kwargs)

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, group, version, preferred)

returns a dictionary of resources associated with provided (prefix, group, version)

async invalidate_cache()
async parse_api_groups(request_resources=False, update=False) Dict

Discovers all API groups present in the cluster

abstractmethod async search(prefix=None, group=None, api_version=None, kind=None, **kwargs)
property version
class kubernetes.aio.dynamic.discovery.EagerDiscoverer(client, cache_file)

Bases: Discoverer

A 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(**kwargs)

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.aio.dynamic.discovery.LazyDiscoverer(client, cache_file)

Bases: Discoverer

A 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()
async search(**kwargs)
class kubernetes.aio.dynamic.discovery.ResourceGroup(preferred, resources=None)

Bases: object

Helper class for Discoverer container

to_dict()