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 the provided key and stores it in the given object. Callers use this to retrieve specific resources like Pods, Deployments, or Services by their unique identifier.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
keyclient.ObjectKeyThe unique identifier for the Kubernetes object to retrieve, typically consisting of its name and namespace.
objclient.ObjectThe Kubernetes object to populate with the retrieved data. This object's type determines the kind of resource being fetched.
optsclient.GetOptionOptional parameters for the get operation, such as specifying a particular API version or resource version.

Returns

TypeDescription
errorAn error if the object could not be retrieved from the cache, 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, applying the given list options. Callers use this to retrieve collections of resources, such as all Pods in a namespace or all Deployments matching certain labels.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the request, used for cancellation and deadlines.
listclient.ObjectListThe Kubernetes object list to populate with the retrieved data. Its type determines the kind of resources being listed (e.g., PodList, DeploymentList).
optsclient.ListOptionOptional parameters for the list operation, such as label selectors, field selectors, or namespace filters.

Returns

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