K8sClientWrapper
No overview available.
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 cluster. Callers use this to retrieve the current state of a specific resource.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| key | client.ObjectKey | The key identifying the Kubernetes object to retrieve, typically including its name and namespace. |
| obj | client.Object | A pointer to the object where the retrieved data will be stored. This object's type determines the kind of resource to fetch. |
| opts | client.GetOption | Optional parameters for the Get operation, such as field selectors or label selectors. |
Returns
| Type | Description |
|---|---|
error | An error if the operation failed, 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 cluster. Callers use this to retrieve collections of resources that match certain criteria.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| list | client.ObjectList | A pointer to an object list where the retrieved data will be stored. This object's type determines the kind of resources to list. |
| opts | client.ListOption | Optional parameters for the List operation, such as field selectors, label selectors, or pagination options. |
Returns
| Type | Description |
|---|---|
error | An error if the operation failed, otherwise nil. |
Create()
@classmethod
def Create(
ctx: context.Context,
obj: client.Object,
opts: client.CreateOption
) - > error
Creates a new Kubernetes object in the cluster. Callers use this to provision new resources.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| obj | client.Object | The Kubernetes object to create. This object must contain all necessary specifications for the resource. |
| opts | client.CreateOption | Optional parameters for the Create operation, such as dry run options. |
Returns
| Type | Description |
|---|---|
error | An error if the creation failed, otherwise nil. |
Delete()
@classmethod
def Delete(
ctx: context.Context,
obj: client.Object,
opts: client.DeleteOption
) - > error
Deletes a Kubernetes object from the cluster. Callers use this to remove existing resources.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| obj | client.Object | The Kubernetes object to delete. This object typically only needs its name and namespace to identify it. |
| opts | client.DeleteOption | Optional parameters for the Delete operation, such as deletion propagation policies or grace periods. |
Returns
| Type | Description |
|---|---|
error | An error if the deletion failed, otherwise nil. |
Update()
@classmethod
def Update(
ctx: context.Context,
obj: client.Object,
opts: client.UpdateOption
) - > error
Updates an existing Kubernetes object in the cluster. Callers use this to modify the entire specification of a resource.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| obj | client.Object | The Kubernetes object with the updated specification. The object's metadata (name, namespace) identifies the resource to update. |
| opts | client.UpdateOption | Optional parameters for the Update operation, such as dry run options. |
Returns
| Type | Description |
|---|---|
error | An error if the update failed, otherwise nil. |
Patch()
@classmethod
def Patch(
ctx: context.Context,
obj: client.Object,
patch: client.Patch,
opts: client.PatchOption
) - > error
Applies a partial update to a Kubernetes object in the cluster. Callers use this to modify specific fields of a resource without replacing the entire object.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| obj | client.Object | The Kubernetes object to patch. Its metadata (name, namespace) identifies the resource. |
| patch | client.Patch | The patch to apply to the object, specifying the changes to be made. |
| opts | client.PatchOption | Optional parameters for the Patch operation, such as dry run options. |
Returns
| Type | Description |
|---|---|
error | An error if the patch operation failed, otherwise nil. |
DeleteAllOf()
@classmethod
def DeleteAllOf(
ctx: context.Context,
obj: client.Object,
opts: client.DeleteAllOfOption
) - > error
Deletes all Kubernetes objects of a specific type that match certain criteria. Callers use this to perform bulk deletions of resources.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, allowing cancellation and timeouts. |
| obj | client.Object | An empty Kubernetes object of the type to be deleted. This object's type determines the kind of resources to delete. |
| opts | client.DeleteAllOfOption | Optional parameters for the DeleteAllOf operation, such as label selectors or field selectors to filter the objects to be deleted. |
Returns
| Type | Description |
|---|---|
error | An error if the bulk deletion failed, otherwise nil. |
Status()
@classmethod
def Status() - > client.StatusWriter
Retrieves a StatusWriter for updating the status subresource of a Kubernetes object. Callers use this to update only the status field of a resource, which is often managed separately from the main spec.
Returns
| Type | Description |
|---|---|
client.StatusWriter | A StatusWriter interface that allows updating the status subresource of a Kubernetes object. |