Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snapshot size to VSC created for VGS #1011

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

Madhu-1
Copy link
Contributor

@Madhu-1 Madhu-1 commented Feb 14, 2024

Currently the RestoreSize is missing when the corresponding VSC are created for the the volumesnapshotgroup, This PR adds the missing RestoreSize for VSC.

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:

Which issue(s) this PR fixes:

Fixes #1002

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

This change will update the Restore size in volumesnapshotcontent to the size it's received from the CSI driver. If `0` is received, it won't be added to the Restore size as it means it is unspecified as per CSI spec.

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Feb 14, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 14, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @Madhu-1. Thanks for your PR.

I'm waiting for a kubernetes-csi 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.

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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 14, 2024
@Madhu-1
Copy link
Contributor Author

Madhu-1 commented Feb 14, 2024

/assign @xing-yang
/assign @nixpanic

@@ -446,7 +446,7 @@ func (ctrl *csiSnapshotSideCarController) updateSnapshotContentStatus(
SnapshotHandle: &snapshotHandle,
ReadyToUse: &readyToUse,
CreationTime: &createdAt,
RestoreSize: &size,
RestoreSize: size,
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if all the pointers to size int64 is really needed. size == 0 already indicates that the value is optional from a CSI Spec point of view:

// Information about a specific snapshot.
message Snapshot {
  // This is the complete size of the snapshot in bytes. The purpose of
  // this field is to give CO guidance on how much space is needed to
  // create a volume from this snapshot. The size of the volume MUST NOT
  // be less than the size of the source snapshot. This field is
  // OPTIONAL. If this field is not set, it indicates that this size is
  // unknown. The value of this field MUST NOT be negative and a size of
  // zero means it is unspecified.
  int64 size_bytes = 1;

This indicates an existing bug when RestoreSize: 0 is set. It should probably never be set to 0 at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that also works, remove the pointer and added size >0 check

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 14, 2024
@nixpanic
Copy link
Contributor

Looks reasonable to me. Can you confirm it addresses issue #1002 ?

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 14, 2024
Currently the RestoreSize is missing when
the corresponding VSC are created for the
the volumesnapshotgroup, This PR adds the missing
RestoreSize for VSC.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 14, 2024
@Madhu-1
Copy link
Contributor Author

Madhu-1 commented Feb 14, 2024

below is the volumesnapshotcontent after the fix, i can see restoreSize is set to expected value

[$]kubectl get volumesnapshotcontent snapcontent-e67b491e059be31f49753afffe159d8a9952b7039027558fe7fb4fd7fedec218-2024-02-14-2.37.11 -oyaml
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotContent
metadata:
  creationTimestamp: "2024-02-14T14:37:11Z"
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshotcontent-bound-protection
  generation: 2
  name: snapcontent-e67b491e059be31f49753afffe159d8a9952b7039027558fe7fb4fd7fedec218-2024-02-14-2.37.11
  resourceVersion: "275842"
  uid: 7b365bcd-741c-4a26-94e9-972826dec2c7
spec:
  deletionPolicy: Delete
  driver: rook-ceph.cephfs.csi.ceph.com
  source:
    snapshotHandle: 0001-0009-rook-ceph-0000000000000001-1a14a2e3-6bbe-48d2-8b48-f47d4a7a1cab
  volumeSnapshotRef:
    kind: VolumeSnapshots
    name: snapshot-e67b491e059be31f49753afffe159d8a9952b7039027558fe7fb4fd7fedec218-2024-02-14-2.37.11
    namespace: default
    uid: a7fb44af-6137-4801-b132-ad12b9464506
status:
  creationTime: 1707921431731229233
  readyToUse: true
  restoreSize: 1073741824
  snapshotHandle: 0001-0009-rook-ceph-0000000000000001-1a14a2e3-6bbe-48d2-8b48-f47d4a7a1cab
  volumeGroupSnapshotHandle: 0001-0009-rook-ceph-0000000000000001-b76b4108-7d72-404c-aad0-e23e1fc2ac8b

@nixpanic
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2024
@nixpanic
Copy link
Contributor

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 14, 2024
@xing-yang
Copy link
Collaborator

Can you add a release note?

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Feb 14, 2024
@k8s-ci-robot k8s-ci-robot removed the release-note-none Denotes a PR that doesn't merit a release note. label Feb 14, 2024
@Madhu-1
Copy link
Contributor Author

Madhu-1 commented Feb 14, 2024

Can you add a release note?

@xing-yang updated the release notes, can you please check and let me know if there is any other suggestion on it.

@xing-yang
Copy link
Collaborator

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Madhu-1, xing-yang

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:

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

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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VolumesnapshotContent RestoreSize is set to 0 for the snapshots created for volumesnapshotgroup
4 participants