You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
VolumeSnapshot Using Stash
This guide will give you an overview of how VolumeSnapshot process works in Stash.
How Backup Process Works?
The following diagram shows how Stash creates VolumeSnapshot via Kubernetes native API. Open the image in a new tab to see the enlarged version.
The VolumeSnapshot process consists of the following steps:
- At first, a user creates a - BackupConfigurationcrd which specifies the targeted workload or targeted PVC.
- Stash operator watches for - BackupConfigurationcrd.
- When it finds a - BackupConfigurationcrd, it creates a- CronJobto take a periodic backup of the target volumes.
- The - CronJobtriggers backup on each scheduled time slot by creating a- BackupSessioncrd.
- Stash operator watches for - BackupSessioncrd.
- When it finds a - BackupSessioncrd, it creates a volume snapshotter- Jobto take snapshot of the targeted volumes.
- The volume snapshotter - Jobcreates- VolumeSnapshotcrd for each PVC of the target and waits for the CSI driver to complete snapshotting. These- VolumeSnasphotcrd names follow the following format:
  <PVC name>-<BackupSession creation timestamp in Unix epoch seconds>
- CSI - external-snapshottercontroller watches for- VolumeSnapshot.
- When it finds a - VolumeSnapshotobject, it backups- VolumeSnapshotin the respective cloud storage.
- Once the snapsotting is completed, Stash Operator updates the - status.phasefield of the- BackupSessioncrd.
How Restore Process Works?
The following diagram shows how Stash restores PersistentVolumeClaims from snapshot using Kubernetes VolumeSnapshot API. Open the image in a new tab to see the enlarged version.
The restore process consists of the following steps:
- At first, a user creates a - RestoreSessioncrd which specifies the- volumeClaimTemplates.- VolumeClaimTemplateshold the information about- VolumeSnapshot.
- Stash operator watches for - RestoreSessioncrd.
- When it finds a - RestoreSessioncrd, it creates a Restore- Jobto restore PVC from the snapshot.
- The restore - Jobcreates PVC with- spec.dataSourcefield set to the respective VolumeSnapshot name.
- CSI - external-snapshottercontroller watches for PVC.
- When it finds a new PVC with - spec.dataSourcefield set, it reads the information about the- VolumeSnapshot.
- The controller downloads the respective data from the cloud and populate the PVC with it. 
- Once restore process is completed, the Stash operator updates the - status.phasefield of the- BackupSessioncrd.







