Skip to main content

ApplyContainerImageOverride

Applies a container image override to a specified container within a PodSpec. It iterates through the containers in the PodSpec and updates the image of the container matching the primary container name.

def ApplyContainerImageOverride(
podSpec: *v1.PodSpec,
containerImage: string,
primaryContainerName: string
) - > null

Overrides the container image for a specific container within a given PodSpec. This function is used to modify the image of a primary container, typically for testing or deployment purposes.

Parameters

NameTypeDescription
podSpec*v1.PodSpecThe PodSpec object whose container image needs to be overridden. This object will be modified in place.
containerImagestringThe new container image string to apply to the primary container (e.g., "myregistry/myimage:latest").
primaryContainerNamestringThe name of the container within the PodSpec to target for the image override. Only the container matching this name will have its image updated.

Returns

TypeDescription
nullNone