Skip to content

Support disk image snapshots #924

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

Closed
mattcary opened this issue Mar 1, 2022 · 8 comments · Fixed by #926 or #929
Closed

Support disk image snapshots #924

mattcary opened this issue Mar 1, 2022 · 8 comments · Fixed by #926 or #929
Assignees

Comments

@mattcary
Copy link
Contributor

mattcary commented Mar 1, 2022

I believe the right documentation is https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images for creating, and https://cloud.google.com/compute/docs/disks/create-disk-from-source.

To create the disk image, a parameter could be added to the VolumeSnapshotClass. For restoring, the existing volume cloning support (create from VolumeSource) may just work, or additional plumbing may be required.

It's also necessary to look into the zonal vs regional behavior of disk images and see if anything needs to be done around that.

@luohao
Copy link
Contributor

luohao commented Mar 3, 2022

@mattcary I think the following changes need to be made to enable disk image snapshots:

  • add disk image create/delete/list/get function to CloudProvider
  • add a parameter to VolumeSnapshotClass and update CreateSnapshot() in CSI driver to create snapshots/images based on the VolumeSnapshotClass config
  • update InsertDisk() in CloudProvider to check snapshot type and set source appropriately in the disk creation request. The existing VolumeSource is sufficient to support clones from images and we can tell what the source is from the snapshot ID.
  • update ListSnapshots() in CSI driver to query both images and snapshots and concatenate the results.

I have only found regional/multi-regional disk images in the doc and the only difference is the storage locations(e.g., ['us-central-1'] v.s. ['us']. I think no extra change is required to support both.

I have two questions:

  • the ListSnapshots API in CSI driver returns nextToken for pagination. Since we list the snapshots from two sources(snapshots and images), should we concatenate the results and return our own token? Is there a better way of implementing it?
  • I am adding tests(unit, sanity, e2e). Is there a test infra that I can use to run e2e tests before I post the PR? I looked at testgrid and it says tests are triggered after you create pull request.

@mattcary
Copy link
Contributor Author

mattcary commented Mar 3, 2022 via email

@luohao
Copy link
Contributor

luohao commented Mar 3, 2022

Thanks @mattcary for the pointers, they are super helpful.

I'll post a PR and we can iterate on that.

/assign @luohao

@luohao
Copy link
Contributor

luohao commented Mar 10, 2022

@mattcary I created a PR(#926), but the tests are not running. Looks like it needs verification from maintainers. Can you help with that?

@mattcary
Copy link
Contributor Author

mattcary commented Mar 10, 2022 via email

@mattcary
Copy link
Contributor Author

implementation PR looks basically good, the next thing to think about after it gets submitted is getting support in k/k e2e tests (which is done here through test/k8s-integration). I think we can just add a new snapshot class to the test config, but it needs digging into.

@luohao
Copy link
Contributor

luohao commented Mar 11, 2022

Thanks @mattcary.

I have another patch that adds new test cases in e2e and integration tests. Should I push to the existing PR or create a new PR?

In my patch, I added a new snapshot class that doubles the test configs the test will run(and potentially double the time it runs). Would that be OK or do we need to just create a single test config for disk image snapshot?

@mattcary
Copy link
Contributor Author

Let's do the e2e & integration tests in a new PR.

I think the new snapshot class that runs all the tests through disk images is the right thing to do---anyway, let's discuss in that PR so we can be concrete, I'm not quite sure what you mean by a single test config here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants