Skip to main content

K8sCacheWrapper

No overview available.

Attributes

AttributeTypeDescription
Cachecache.CacheThis field embeds the cache.Cache interface, providing the K8sCacheWrapper with all the methods and fields defined in the cache.Cache interface, allowing it to function as a cache.

Methods


Get()

@classmethod
def Get(
ctx: context.Context,
key: client.ObjectKey,
obj: client.Object,
opts: client.GetOption
) - > error

Fetches a single Kubernetes object from the cache using its key. Callers use this to retrieve the current state of a specific resource.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
keyclient.ObjectKeyThe key identifying the Kubernetes object to retrieve, typically containing its name and namespace.
objclient.ObjectThe object to populate with the retrieved data. This should be a pointer to a Kubernetes API type (e.g., *corev1.Pod).
optsclient.GetOptionOptional parameters for the get operation, such as specifying a field selector.

Returns

TypeDescription
errorAn error if the object could not be retrieved, otherwise nil.

List()

@classmethod
def List(
ctx: context.Context,
list: client.ObjectList,
opts: client.ListOption
) - > error

Lists multiple Kubernetes objects of a specific type from the cache. Callers use this to retrieve collections of resources that match certain criteria.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
listclient.ObjectListThe list object to populate with the retrieved data. This should be a pointer to a Kubernetes API list type (e.g., *corev1.PodList).
optsclient.ListOptionOptional parameters for the list operation, such as namespace, labels, or field selectors.

Returns

TypeDescription
errorAn error if the list operation failed, otherwise nil.