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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, used for logging and cancellation. |
| cfg | config.FlyteCoPilotConfig | The CoPilot configuration, providing default paths and volume names for input and output. |
| c | *v1.Container | The Kubernetes container object to which CoPilot features will be added. Its SecurityContext and VolumeMounts may be modified. |
| iFace | *core.TypedInterface | The typed interface of the container, which specifies if the container has inputs or outputs, guiding the creation of volume mounts. |
| pilot | *core.DataLoadingConfig | The data loading configuration for CoPilot, which determines if CoPilot is enabled and can override default input/output paths. |
Returns
| Type | Description |
|---|---|
error | Returns an error if any configuration fails, otherwise returns nil. |