kubevirt / kubevirt-velero-plugin

Plugin to Velero which automates backing up and restoring KubeVirt/CDI objects
Apache License 2.0
29 stars 28 forks source link

Implement KVGraph package to allow retrieving a defined list of vm-related objects #260

Closed alromeros closed 1 month ago

alromeros commented 1 month ago

What this PR does / why we need it:

This PR implements a new kvgraph package so we allow an exportable way to retrieve all the VM-related resources.

In this way, third-party software can use our package to retrieve the list of resources related to a specific VM:


// Backup

// If we want to easily get the list of backup objects for any unstructured item
backupResources := vmgraph.NewObjectBackupGraph(item)

// Alternatively, we can pass the converted object to their specific functions
backupResources := kvgraph.NewVirtualMachineBackupGraph(vm)
backupResources := kvgraph.NewVirtualMachineInstanceBackupGraph(vmi)
backupResources := kvgraph.NewDataVolumeBackupGraph(dv)

// Restore

// If we want to easily get the list of restore objects for any unstructured item
restoreResources := kvgraph.NewObjectRestoreGraph(item)

// Alternatively, we can pass the converted object to their specific functions
vestoreResources := kvgraph.NewVirtualMachineRestoreGraph(vm)
restoreResources := kvgraph.NewVirtualMachineInstanceRestoreGraph(vmi)

Which issue(s) this PR fixes (optional, in fixes #(, fixes #, ...) format, will close the issue(s) when PR gets merged): Fixes # https://issues.redhat.com/browse/CNV-41501

Release note:

Implement a kvgraph package to allow retrieving a defined list of vm-related objects
kubevirt-bot commented 1 month ago

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

alromeros commented 1 month ago

/test pull-kvp-functional-test

alromeros commented 1 month ago

/test pull-kvp-functional-test

alromeros commented 1 month ago

/test pull-kvp-functional-test

mhenriks commented 1 month ago

/lgtm /approve

kubevirt-bot commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mhenriks

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](https://github.com/kubevirt/kubevirt-velero-plugin/blob/main/OWNERS)~~ [mhenriks] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment