Skip to main content

AddCoPilotToContainer

Adds CoPilot functionality to a given container by configuring volume mounts for input and output paths based on the provided CoPilot configuration and interface. This function modifies the container object directly by appending volume mounts if CoPilot is enabled.

def AddCoPilotToContainer(
ctx: context.Context,
cfg: config.FlyteCoPilotConfig,
c: *v1.Container,
iFace: *core.TypedInterface,
pilot: *core.DataLoadingConfig
) - > error

Configures a Kubernetes container to enable CoPilot functionality. This involves setting up security contexts and mounting volumes for input and output data based on the CoPilot configuration and the container's interface.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for logging and cancellation.
cfgconfig.FlyteCoPilotConfigThe CoPilot configuration, providing default paths and volume names for input and output.
c*v1.ContainerThe Kubernetes container object to which CoPilot features will be added. Its SecurityContext and VolumeMounts may be modified.
iFace*core.TypedInterfaceThe typed interface of the container, which specifies if the container has inputs or outputs, guiding the creation of volume mounts.
pilot*core.DataLoadingConfigThe data loading configuration for CoPilot, which determines if CoPilot is enabled and can override default input/output paths.

Returns

TypeDescription
errorReturns an error if any configuration fails, otherwise returns nil.