diff --git a/pkg/restic/common.go b/pkg/restic/common.go index 80ed99935b..9d55afbc1d 100644 --- a/pkg/restic/common.go +++ b/pkg/restic/common.go @@ -39,13 +39,17 @@ const ( InitContainer = "restic-wait" DefaultMaintenanceFrequency = 24 * time.Hour - podAnnotationPrefix = "snapshot.velero.io/" + // Deprecated. + podAnnotationPrefix = "snapshot.velero.io/" + volumesToBackupAnnotation = "backup.velero.io/backup-volumes" ) // PodHasSnapshotAnnotation returns true if the object has an annotation // indicating that there is a restic snapshot for a volume in this pod, // or false otherwise. +// Deprecated: we will stop using pod annotation to determine restic +// volumes to backup. func PodHasSnapshotAnnotation(obj metav1.Object) bool { for key := range obj.GetAnnotations() { if strings.HasPrefix(key, podAnnotationPrefix) { @@ -58,6 +62,8 @@ func PodHasSnapshotAnnotation(obj metav1.Object) bool { // GetPodSnapshotAnnotations returns a map, of volume name -> snapshot id, // of all restic snapshots for this pod. +// Deprecated: we will stop using pod annotation to determine restic +// volumes to backup. func GetPodSnapshotAnnotations(obj metav1.Object) map[string]string { var res map[string]string @@ -79,6 +85,8 @@ func GetPodSnapshotAnnotations(obj metav1.Object) map[string]string { // SetPodSnapshotAnnotation adds an annotation to a pod to indicate that // the specified volume has a restic snapshot with the provided id. +// Deprecated: we will stop using pod annotation to determine restic +// volumes to backup. func SetPodSnapshotAnnotation(obj metav1.Object, volumeName, snapshotID string) { annotations := obj.GetAnnotations() diff --git a/site/docs/master/restic.md b/site/docs/master/restic.md index ed82ef3cf3..4f6e951d4f 100644 --- a/site/docs/master/restic.md +++ b/site/docs/master/restic.md @@ -283,14 +283,12 @@ should be taken (`backup.velero.io/backup-volumes`) - finds the pod volume's subdirectory within the above volume - runs `restic backup` - updates the status of the custom resource to `Completed` or `Failed` -1. As each `PodVolumeBackup` finishes, the main Velero process captures its restic snapshot ID and adds it as an annotation -to the copy of the pod JSON that's stored in the Velero backup. This will be used for restores, as seen in the next section. +1. As each `PodVolumeBackup` finishes, the main Velero process adds it to the Velero backup in a file named `-podvolumebackups.json.gz`. This file gets uploaded to object storage alongside the backup tarball. It will be used for restores, as seen in the next section. ### Restore -1. The main Velero restore process checks each pod that it's restoring for annotations specifying a restic backup -exists for a volume in the pod (`snapshot.velero.io/`) -1. When found, Velero first ensures a restic repository exists for the pod's namespace, by: +1. The main Velero restore process checks each pod that it's restoring from a previously created restic backup by iterating through the contents of the `-podvolumebackups.json.gz` file. +1. For each pod found, Velero first ensures a restic repository exists for the pod's namespace, by: - checking if a `ResticRepository` custom resource already exists - if not, creating a new one, and waiting for the `ResticRepository` controller to init/check it (note that in this case, the actual repository should already exist in object storage, so the Velero controller will simply @@ -319,4 +317,4 @@ on to running other init containers/the main containers. [3]: https://github.com/heptio/velero/releases/ [4]: https://kubernetes.io/docs/concepts/storage/volumes/#local [5]: http://restic.readthedocs.io/en/latest/100_references.html#terminology -[6]: https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation +[6]: https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation \ No newline at end of file