Skip to content

Conversation

@khushiiagrawal
Copy link

Description of changes:

This PR adds support for the dataSource field when creating PVCs via the KFP Python SDK.

Fixes #11420

Why:

The dataSource field is part of the Kubernetes PVC spec and is essential for workflows that need pre-initialized volumes, such as:

  • Restoring a VolumeSnapshot for processing
  • Cloning an existing PVC for parallel workflows

Currently, users have to create custom components to achieve this. This change brings native support to kubernetes.CreatePVC().

What changed:

  1. Proto schema (kubernetes_platform/proto/kubernetes_executor_config.proto)

    • Added TypedLocalObjectReference message to represent the Kubernetes type
    • Added data_source field to CreatePvc message
  2. Python SDK (kubernetes_platform/python/kfp/kubernetes/volume.py)

    • Added optional data_source parameter to CreatePVC component
  3. Backend driver (backend/src/v2/driver/k8s.go)

    • Added buildPVCDataSource helper function to convert input to Kubernetes TypedLocalObjectReference
    • Updated createPVC to set DataSource on the PVC spec
  4. Regenerated protobuf files

    • kubernetes_executor_config.pb.go (Go)
    • kubernetes_executor_config_pb2.py (Python)
  5. Updated snapshot tests to include data_source parameter definition

Example usage:

pvc = kubernetes.CreatePVC(
    pvc_name_suffix='-my-pvc',
    access_modes=['ReadWriteOnce'],
    size='100Gi',
    data_source={
        'api_group': 'snapshot.storage.k8s.io',
        'kind': 'VolumeSnapshot',
        'name': 'my-snapshot'
    },
)

Checklist:

Copilot AI review requested due to automatic review settings January 22, 2026 15:25
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hbelmiro for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow
Copy link

Hi @khushiiagrawal. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the dataSource field when creating PersistentVolumeClaims (PVCs) through the KFP Python SDK, enabling workflows to restore from VolumeSnapshots or clone existing PVCs without custom components.

Changes:

  • Added data_source parameter to the CreatePVC component in the Python SDK
  • Extended the protobuf schema with TypedLocalObjectReference message and data_source field
  • Implemented buildPVCDataSource helper in the Go backend to process and apply the data source during PVC creation

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
kubernetes_platform/python/kfp/kubernetes/volume.py Added data_source parameter with documentation to CreatePVC function
kubernetes_platform/proto/kubernetes_executor_config.proto Added TypedLocalObjectReference message and data_source field to CreatePvc message
kubernetes_platform/go/kubernetesplatform/kubernetes_executor_config.pb.go Generated Go protobuf code for new TypedLocalObjectReference and updated CreatePvc
kubernetes_platform/python/kfp/kubernetes/kubernetes_executor_config_pb2.py Generated Python protobuf code for new schema additions
backend/src/v2/driver/k8s.go Implemented buildPVCDataSource helper and integrated data_source into PVC creation
kubernetes_platform/python/test/snapshot/data/*.yaml Updated snapshot tests to include data_source parameter definition
kubernetes_platform/python/test/snapshot/data/create_mount_delete_dynamic_pvc.py Added test example using data_source with VolumeSnapshot

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hbelmiro
Copy link
Contributor

/ok-to-test

@hbelmiro
Copy link
Contributor

/retest

@github-actions
Copy link

🎉 Welcome to the Kubeflow Pipelines repo! 🎉

Thanks for opening your first PR! We're excited to have you onboard 🚀

Next steps:

Feel free to ask questions in the comments.

@hbelmiro
Copy link
Contributor

/ok-to-test

@khushiiagrawal
Copy link
Author

@hbelmiro a gentle ping.
thanks!

@hbelmiro
Copy link
Contributor

/ok-to-test

@hbelmiro
Copy link
Contributor

@khushiiagrawal we have issues with /ok-to-test. I've sent a PR to fix it. It's waiting for review.

@hbelmiro
Copy link
Contributor

/ok-to-test

@hbelmiro
Copy link
Contributor

@khushiiagrawal can you please rebase?

@khushiiagrawal
Copy link
Author

@hbelmiro I have rebased. Thank you so much.

@hbelmiro
Copy link
Contributor

/ok-to-test

@khushiiagrawal
Copy link
Author

@hbelmiro @droctothorpe all the CIs are passed , but the CI check is failing for some reason i don't know why
the PR is ready , PTAL.

@hbelmiro
Copy link
Contributor

/ok-to-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Support Datasource Field for PVC Creation in KFP Python SDK

2 participants