AddCoPilotToPod
Adds CoPilot-related containers and volumes to a Kubernetes PodSpec if CoPilot is enabled. It configures init containers for downloading inputs and a sidecar container for uploading outputs, based on the task's interface and CoPilot configuration.
def AddCoPilotToPod(
ctx: context.Context,
cfg: config.FlyteCoPilotConfig,
coPilotPod: *v1.PodSpec,
iFace: *core.TypedInterface,
taskExecMetadata: core2.TaskExecutionMetadata,
inputPaths: io.InputFilePaths,
outputPaths: io.OutputFilePaths,
pilot: *core.DataLoadingConfig
) - > error
Configures a Kubernetes PodSpec to include CoPilot containers for data loading and uploading, enabling efficient data handling for tasks. This function should be used to inject CoPilot functionality into a pod definition.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the operation, used for logging and cancellation. |
| cfg | config.FlyteCoPilotConfig | The CoPilot configuration, including default paths, volume names, and timeouts. |
| coPilotPod | *v1.PodSpec | The Kubernetes PodSpec to which CoPilot volumes and init containers will be added. |
| iFace | *core.TypedInterface | The typed interface of the task, containing definitions for inputs and outputs, used to determine what data needs to be handled by CoPilot. |
| taskExecMetadata | core2.TaskExecutionMetadata | Metadata about the task execution, including task ID and resource overrides, used for logging and calculating storage size. |
| inputPaths | io.InputFilePaths | The paths to the input files for the task, which CoPilot will download. |
| outputPaths | io.OutputFilePaths | The paths for the output files of the task, which CoPilot will upload. |
| pilot | *core.DataLoadingConfig | The data loading configuration for CoPilot, indicating if it's enabled and specifying custom input/output paths and format. |
Returns
| Type | Description |
|---|---|
error | An error if any configuration or container creation fails, otherwise nil. |