Skip to content

Move member VolumeSnapshotContents creation to the sidecar#1288

Closed
leonardoce wants to merge 1 commit intokubernetes-csi:masterfrom
leonardoce:listsnapshots-restoresize
Closed

Move member VolumeSnapshotContents creation to the sidecar#1288
leonardoce wants to merge 1 commit intokubernetes-csi:masterfrom
leonardoce:listsnapshots-restoresize

Conversation

@leonardoce
Copy link
Contributor

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:

It allows the use of information from the CreateGroupSnapshot RPC call to fill out the status of VolumeSnapshotContents and set the restoreSize field even when the ListSnapshots GRPC call is not implemented.

Which issue(s) this PR fixes:

Fixes #1271

Special notes for your reviewer:

A subsequent PR will thread a context to the function where the member VolumeSnapshotContents are created.

Does this PR introduce a user-facing change?:

The restoreSize field is now set when creating a VolumeGroupSnapshot even if the CSI Driver does not implement the ListSnapshots GRPC call. Starting from this release, the CSI snapshotter sidecar requires RBAC permission to create VolumeSnapshotContents objects.

This allows using the information from the CreateGroupSnapshot RPC call
to fill the status of VolumeSnapshotContents, and to set the restoreSize
field even when the ListSnapshots GRPC call is not implemented.
@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Apr 7, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 7, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: leonardoce
Once this PR has been reviewed and has the lgtm label, please assign jsafrane for approval. For more information see the 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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 7, 2025
@leonardoce
Copy link
Contributor Author

With this PR, member VolumeSnapshot objects have the restoreSize attribute set even when the ListSnapshot GRPC call is not implemented.

What follows is an example using rook-ceph.cephfs.csi.ceph.com:

apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
  creationTimestamp: "2025-04-07T15:19:47Z"
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection
  - snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection
  generation: 1
  name: snapshot-561edd9357eaf7437ebf35517d7c65dde0835aa172959e822af7224cbf62e1e5
  namespace: default
  ownerReferences:
  - apiVersion: groupsnapshot.storage.k8s.io/v1beta1
    kind: VolumeGroupSnapshot
    name: new-groupsnapshot-demo
    uid: 6fc6c8d9-437a-4cf9-a142-93955cd93292
  resourceVersion: "5554"
  uid: 0c1af52e-9706-41bb-837a-e50ac79b8395
spec:
  source:
    persistentVolumeClaimName: cluster-example-1
status:
  boundVolumeSnapshotContentName: snapcontent-561edd9357eaf7437ebf35517d7c65dde0835aa172959e822af7224cbf62e1e5
  creationTime: "2025-04-07T15:19:44Z"
  readyToUse: true
  restoreSize: 1Gi
  volumeGroupSnapshotName: new-groupsnapshot-demo
---
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotContent
metadata:
  annotations:
    groupsnapshot.storage.k8s.io/volumeGroupSnapshotHandle: 0001-0009-rook-ceph-0000000000000001-a3cb7755-9512-41bc-b330-54621dd0245e
    snapshot.storage.kubernetes.io/deletion-secret-name: rook-csi-cephfs-provisioner
    snapshot.storage.kubernetes.io/deletion-secret-namespace: rook-ceph
  creationTimestamp: "2025-04-07T15:19:44Z"
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshotcontent-bound-protection
  generation: 2
  name: snapcontent-561edd9357eaf7437ebf35517d7c65dde0835aa172959e822af7224cbf62e1e5
  resourceVersion: "5549"
  uid: 3a4fd8e4-dc5d-42d9-8825-f2d506ff869b
spec:
  deletionPolicy: Delete
  driver: rook-ceph.cephfs.csi.ceph.com
  source:
    volumeHandle: 0001-0009-rook-ceph-0000000000000001-d251aa4b-679f-4ad4-896c-5b42fdb5bdfd
  volumeSnapshotRef:
    kind: VolumeSnapshot
    name: snapshot-561edd9357eaf7437ebf35517d7c65dde0835aa172959e822af7224cbf62e1e5
    namespace: default
    uid: 0c1af52e-9706-41bb-837a-e50ac79b8395
status:
  creationTime: 1744039184168252000
  readyToUse: true
  restoreSize: 1073741824
  snapshotHandle: 0001-0009-rook-ceph-0000000000000001-3f1acff9-bede-4fd7-92b4-d6f68a0604cf
  volumeGroupSnapshotHandle: 0001-0009-rook-ceph-0000000000000001-a3cb7755-9512-41bc-b330-54621dd0245e

I also tested it using the CSI host path driver with the ListSnapshots GRPC call disabled.

@leonardoce leonardoce closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restoreSize field not being set for the snapshots created for VolumeGroupSnapshot

2 participants