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, ensuring no naming conflicts with existing volumes or mounts.

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 SharedMemory object containing the configuration details for the shared memory, including its mount name, mount path, and optional size limit.

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.