Added Kubeflow Pipeline component for ModelKit packaging and OCI push
Kubeflow Pipelines lacked a reusable component for packaging trained model artifacts as ModelKits and pushing them to OCI-compliant registries. This gap made it difficult to standardize model packaging and automate model delivery to registries within Kubeflow workflows.
What Has Been Added Reusable Kubeflow Pipeline Component: A new component that: Extracts training parameters, pipeline run ID, experiment name, and metrics from Kubeflow ML Metadata. Packages model artifacts using the ModelKit format. Pushes the packaged ModelKit to any OCI-compliant registry. Supports authentication via Kubernetes secrets or IRSA/Workload Identity for cloud environments. Component Implementation: component.py: Python script for metadata extraction, packaging, and push logic.
Dockerfile: Container image definition with all dependencies. component.yaml: KFP component specification for easy integration. This addition enables seamless, standardized, and secure model packaging and registry integration for Kubeflow users.
Could you drop a Markdown file or other notes here that we can use to create docs for this? Or create a companion docs PR?
Could you drop a Markdown file or other notes here that we can use to create docs for this? Or could you create a companion docs PR?
KFP ModelKit Component
Overview
This Kubeflow Pipeline (KFP) component enables packaging a ModelKit model and pushing it to an OCI (Open Container Initiative) registry. It is designed to be used as a step in automated ML pipelines, making it easy to build, package, and distribute models using ModelKit within Kubeflow.
Files
component.py: Python script implementing the component logic.component.yaml: KFP component specification for pipeline integration.Dockerfile: Container definition for the component runtime environment.
Usage
- Build the Docker image:
docker build -t <your-repo>/kfp-modelkit-component:latest . - Push the image to your registry:
docker push <your-repo>/kfp-modelkit-component:latest - Use in a KFP pipeline:
- Reference
component.yamlin your pipeline definition. - Configure input parameters as needed (see below).
- Reference
Inputs & Parameters
Refer to component.yaml for the full list of parameters. Typical parameters include:
- Model source path
- Model name and version
- OCI registry URL and credentials
- Additional packaging options
Example Pipeline Step
import kfp
from kfp.components import load_component_from_file
modelkit_op = load_component_from_file('component.yaml')
# Example usage in a pipeline
def my_pipeline(...):
modelkit_op(
model_path='path/to/model',
model_name='my-model',
version='1.0.0',
registry_url='oci://my-registry',
# ...other params...
)
Notes
- Ensure all required environment variables and credentials are available at runtime.
- The component is designed for use with ModelKit and OCI-compliant registries.
- For advanced usage, customize
component.pyor the Dockerfile as needed.