Skip to main content

GetContainer

Retrieves a container from a PodSpec by its name. If the container is not found, it returns an error indicating an invalid TaskSpecification.

def GetContainer(
podSpec: *v1.PodSpec,
name: string
) - > *v1.Container, error

Retrieves a specific container from a given pod specification by its name. This function is used to locate and return a container object for further processing or validation.

Parameters

NameTypeDescription
podSpec*v1.PodSpecThe pod specification object containing a list of containers to search through.
namestringThe name of the container to retrieve from the pod specification.

Returns

TypeDescription
*v1.Container, errorThe found container object if it exists, or an error if the container with the specified name is not found within the pod specification.