kanisterio / kanister

An extensible framework for application-level data management on Kubernetes
https://kanister.io
Apache License 2.0
745 stars 153 forks source link

CopyVolumeData enhancement to use Kopia #2921

Open mlavi opened 3 months ago

mlavi commented 3 months ago

In discussion with @michaelcourcy today, he noted that the Kanister CopyVolumeData function exists, but it appears to be Restic specific.

Can we use this function with Kopia and without a Kanister sidecar? Operators cannot implement the sidecar pattern.

hairyhum commented 3 months ago

What we can do about it is to deprecate the restic-specific functions and create new kopia-specific functions for backup compatibility.

hairyhum commented 3 months ago

Draft implementation using kopia repository server can be found here: https://github.com/kanisterio/kanister/pull/2143

michaelcourcy commented 2 months ago

Can we imagine a workflow that include snapshot + export, because the replacement you propose still require a sidecar correct ? We can imagine doing that in 5 steps

  1. Take a snap
  2. Create a PVC clone from the snap
  3. Export the cloned (which is not an issue because the clone is an orphaned pvc)
  4. Output the kopia identifier
  5. Removed the cloned pvc

But that would make sense to create a function for doing the 5 altogether, it would take 3 arguments

arg role example
pvcName The pvc we want to export my-pvc
snapshotClass The snapshot class to use to take the snapshot ebs-snapclass
kopiaRepoPassword The kopia repository password myUn6ue$$ablepwd

And would output the kopia identifier

That would bring a lot to the blueprint author

hairyhum commented 2 months ago

because the replacement you propose still require a sidecar correct

CopyVolumeData and CopyVolumeDataUsingKopiaServer create a new pod with PVC mounted to it, so that's not a sidecar. Or do you mean something else?

But that would make sense to create a function for doing the 5 altogether

That's an interesting question, a function which should do multiple stages sounds a lot like a blueprint. Composability of blueprints is a challenge of course.

What it looks to me is following steps:

  1. CreateCSISnapshot (this one waits for completion)
  2. RestoreCSISnapshot into temp PVC
  3. CopyVolumeDataUsingKopiaServer (this one will save the PVC into kopia using temporary pod and return an identifier)
  4. DeleteCSISnapshot
  5. KubeOps delete temp PVC