Skip to main content

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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
keyclient.ObjectKeyThe key identifying the Kubernetes object to retrieve, typically including its name and namespace.
objclient.ObjectA pointer to the object where the retrieved data will be stored. This object's type determines the kind of resource to fetch.
optsclient.GetOptionOptional parameters for the Get operation, such as field selectors or label selectors.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
listclient.ObjectListA pointer to an object list where the retrieved data will be stored. This object's type determines the kind of resources to list.
optsclient.ListOptionOptional parameters for the List operation, such as field selectors, label selectors, or pagination options.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
objclient.ObjectThe Kubernetes object to create. This object must contain all necessary specifications for the resource.
optsclient.CreateOptionOptional parameters for the Create operation, such as dry run options.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
objclient.ObjectThe Kubernetes object to delete. This object typically only needs its name and namespace to identify it.
optsclient.DeleteOptionOptional parameters for the Delete operation, such as deletion propagation policies or grace periods.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
objclient.ObjectThe Kubernetes object with the updated specification. The object's metadata (name, namespace) identifies the resource to update.
optsclient.UpdateOptionOptional parameters for the Update operation, such as dry run options.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
objclient.ObjectThe Kubernetes object to patch. Its metadata (name, namespace) identifies the resource.
patchclient.PatchThe patch to apply to the object, specifying the changes to be made.
optsclient.PatchOptionOptional parameters for the Patch operation, such as dry run options.

Returns

TypeDescription
errorAn 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

NameTypeDescription
ctxcontext.ContextThe context for the request, allowing cancellation and timeouts.
objclient.ObjectAn empty Kubernetes object of the type to be deleted. This object's type determines the kind of resources to delete.
optsclient.DeleteAllOfOptionOptional parameters for the DeleteAllOf operation, such as label selectors or field selectors to filter the objects to be deleted.

Returns

TypeDescription
errorAn 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

TypeDescription
client.StatusWriterA StatusWriter interface that allows updating the status subresource of a Kubernetes object.