K8sCacheWrapper
No overview available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| Cache | cache.Cache | This 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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| key | client.ObjectKey | The unique identifier for the Kubernetes object to retrieve, typically consisting of its name and namespace. |
| obj | client.Object | The Kubernetes object to populate with the retrieved data. This object's type determines the kind of resource being fetched. |
| opts | client.GetOption | Optional parameters for the get operation, such as specifying a particular API version or resource version. |
Returns
| Type | Description |
|---|---|
error | An 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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| list | client.ObjectList | The Kubernetes object list to populate with the retrieved data. Its type determines the kind of resources being listed (e.g., PodList, DeploymentList). |
| opts | client.ListOption | Optional parameters for the list operation, such as label selectors, field selectors, or namespace filters. |
Returns
| Type | Description |
|---|---|
error | An error if the list operation failed, otherwise nil. |