Skip to content

Conversation

carlbraganza
Copy link
Contributor

@carlbraganza carlbraganza commented Sep 17, 2025

Replaced base_snapshot_name with base_snapshot_id in the GetMetadataRequest Kubernetes SnapshotMetadata API.
The iterator package now accepts both the previous snapshot name or CSI handle with preference given to the handle.

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change

/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
There was an API change requested in Issue 165, and approved by the SIG-Storage DP WG.

Which issue(s) this PR fixes:

Fixes #165

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

action required
The signature of the Kubernetes GetMetadataRequest RPC call has changed.

@k8s-ci-robot k8s-ci-robot added release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 17, 2025
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 17, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 17, 2025
@carlbraganza carlbraganza requested review from PrasadG193 and removed request for hairyhum September 17, 2025 01:32

stringFlag(&args.Namespace, "namespace", "n", "", "The Namespace containing the VolumeSnapshot objects.")
stringFlag(&args.SnapshotName, "snapshot", "s", "", "The name of the VolumeSnapshot for which metadata is to be displayed.")
stringFlag(&args.PrevSnapshotID, "previous-snapshot-id", "P", "", "The CSI handle of an earlier VolumeSnapshot against which changed block metadata is to be displayed.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Just capital "P" maybe a bit confusion, how about p-id or something else?

Copy link
Contributor Author

@carlbraganza carlbraganza Sep 23, 2025

Choose a reason for hiding this comment

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

The P is the short flag and was chosen because the short flag for the name is p. The long flag is -previous-snapshot-id.

@Rakshith-R
Copy link
Contributor

@carlbraganza

We're building test tag here

# minikube image build -f ./cmd/csi-snapshot-metadata/Dockerfile -t gcr.io/k8s-staging-sig-storage/csi-snapshot-metadata:test .

but testing with main tag 🤦 .

CSI_SNAPSHOT_METADATA_REGISTRY="gcr.io/k8s-staging-sig-storage" UPDATE_RBAC_RULES="false" CSI_SNAPSHOT_METADATA_TAG="main" SNAPSHOT_METADATA_TESTS=true HOSTPATHPLUGIN_REGISTRY="gcr.io/k8s-staging-sig-storage" HOSTPATHPLUGIN_TAG="canary" ~/csi-driver-host-path/deploy/kubernetes-latest/deploy.sh

Can you please fix CSI_SNAPSHOT_METADATA_TAG="test" in Line 49 ?
then it should work as expected.

@Rakshith-R
Copy link
Contributor

Can you please take a look at adding tests for previous snapID usage too in the following ?

@carlbraganza
Copy link
Contributor Author

carlbraganza commented Sep 23, 2025

Can you please take a look at adding tests for previous snapID usage too in the following ?

I will try, as soon as I make some progress in understanding the test and making it work.

I presume I can use something like this to extract the snapshot handle:

VSC_NAME=`kubectl get volumesnapshot snap1 -o jsonpath="{.status.boundVolumeSnapshotContentName}"`
SNAP_HANDLE=`kubectl get volumesnapshotcontent $VSC_NAME -o jsonpath="{.status.snapshotHandle}"`

and then repeat the diff with the handle as a parameter instead of snap1.

I will also have to modify the verifier command to take the new flag.

@carlbraganza carlbraganza force-pushed the issue-165 branch 3 times, most recently from d873aef to fdc6de4 Compare September 23, 2025 22:54
GetMetadataRequest Kubernetes SnapshotMetadata API.
The iterator package now accepts both the previous snapshot name or
CSI handle with preference given to the handle.
Copy link
Contributor

@Rakshith-R Rakshith-R left a comment

Choose a reason for hiding this comment

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

Looks good to me,
I'll let @PrasadG193 review too.

@xing-yang
Copy link

Looks good to me as well.
@PrasadG193 can you take a look?

// request is made, and take that into consideration in its snapshot retention policy.
// This field is REQUIRED.
string base_snapshot_name = 3;
string base_snapshot_id = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Just to confirm, are we not supporting volume ID in GetMetadataAllocatedRequest?
  2. Does it make sense to also change target_snapshot_name to target_snapshot_id to make it uniform? Using ID for one and name for other could be confusing for users. Was this discussed and decided in the community meeting?

Choose a reason for hiding this comment

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

  1. Just to confirm, are we not supporting volume ID in GetMetadataAllocatedRequest?

You meant snapshot ID in GetMetadataAllocatedRequest? That is not required because this API only needs one snapshot which is just created and it does not need to be retained for a long time.
The main reason for changing the base_snapshot_name to base_snapshot_id is that so we don't require a storage system to retain a snapshot for a long time which may result in performance degradation on some storage systems, defeating the purpose of using CBT.

  1. Does it make sense to also change target_snapshot_name to target_snapshot_id to make it uniform? Using ID for one and name for other could be confusing for users. Was this discussed and decided in the community meeting?

That's a good point. If we do that, it means the backup vendor will create a VolumeSnapshot first and then retrieve the snapshot_id instead of letting the External Snapshot Metadata sidecar do that.
I'm fine either way.

Choose a reason for hiding this comment

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

Discussed this at DP WG meeting today. @bswartz mentioned that if we change target_snapshot_name to target_snapshot_id, that will affect the rbac control.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, that makes sense. We don't have any other info to validate the auth otherwise

Copy link

@prasadg-veeam prasadg-veeam left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@kubernetes-csi kubernetes-csi deleted a comment from prasadg-veeam Oct 15, 2025
@kubernetes-csi kubernetes-csi deleted a comment from k8s-ci-robot Oct 15, 2025
Copy link
Contributor

@PrasadG193 PrasadG193 left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 15, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carlbraganza, prasadg-veeam, PrasadG193, Rakshith-R

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [PrasadG193,Rakshith-R,carlbraganza]

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

@k8s-ci-robot k8s-ci-robot merged commit b44a413 into kubernetes-csi:main Oct 15, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support CBT without Long-Term Retention of Snapshots

6 participants