Skip to main content

ApplySharedMemory

Applies shared memory configuration to a Kubernetes PodSpec. It adds a shared memory volume to the pod and mounts it into the primary container, performing validation checks to ensure unique mount names and paths.

def ApplySharedMemory(
podSpec: *v1.PodSpec,
primaryContainerName: string,
SharedMemory: *core.SharedMemory
) - > error

Applies shared memory configuration to a given pod specification by adding a shared memory volume and mounting it to the primary container. This function ensures that the shared memory mount name and path are unique within the pod and container.

Parameters

NameTypeDescription
podSpec*v1.PodSpecThe Kubernetes PodSpec to which the shared memory volume and mount will be added. This object will be modified in place.
primaryContainerNamestringThe name of the primary container within the podSpec where the shared memory volume will be mounted. This container must exist in the podSpec.
SharedMemory*core.SharedMemoryA configuration object containing details for the shared memory, including its mount name, mount path, and an optional size limit. The mount name and path must be unique within the pod and container respectively.

Returns

TypeDescription
errorReturns an error if the shared memory mount name or path is not set, if the primary container is not found, if a volume or mount with the same name or path already exists, or if the size limit cannot be parsed.