New to KubeStash? Please start here.

BackupVerificationSession

What is BackupVerificationSession

A BackupVerificationSession is a Kubernetes CustomResourceDefinition(CRD) which represents one backup verification run for the target pointed by the respective BackupConfiguration.

KubeStash operator creates a Kubernetes CronJob according to the schedule for each BackupVerifier referred in a BackupConfiguration. On each backup verification schedule, this CronJob creates a BackupVerificationSession object that corresponds to the respective BackupVerifier referred in the BackupConfiguration. The BackupVerificationSession will create a RestoreSession and a verification executor job to initiate the verification process depending on the verification type.

You can also create a BackupVerificationSession object manually to run verification process at any time.

BackupVerificationSession CRD Specification

Like any official Kubernetes resource, a BackupVerificationSession has TypeMeta, ObjectMeta and Spec , Status sections.

A sample BackupVerificationSession created for verifying an Application and it’s components’ is shown below,

apiVersion: core.kubestash.com/v1alpha1
kind: BackupVerificationSession
metadata:
  creationTimestamp: "2024-10-29T09:30:00Z"
  finalizers:
    - kubestash.com/cleanup
  generation: 1
  labels:
    kubestash.com/invoker-name: sample-backup
  name: freq-backup-demo-storage-1730194200
  namespace: demo
  ownerReferences:
    - apiVersion: core.kubestash.com/v1alpha1
      blockOwnerDeletion: true
      controller: true
      kind: BackupConfiguration
      name: sample-backup
      uid: 645191bb-8e2e-4b04-96bd-3cea5f92231b
  resourceVersion: "42197"
  uid: f2bad4d8-b280-4d88-891c-62db1757ad33
spec:
  invoker:
    apiGroup: core.kubestash.com
    kind: BackupConfiguration
    name: sample-backup
  repository: demo-storage
  session: freq-backup
  snapshot: demo-storage-sample-backup-freq-backup-1730194080
status:
  conditions:
    - lastTransitionTime: "2024-10-29T09:30:10Z"
      reason: SuccessfullySucceedRestore
      status: "True"
      type: RestoreSucceeded
    - lastTransitionTime: "2024-10-29T09:30:11Z"
      reason: SuccessfullyVerifyBackup
      status: "True"
      type: BackupVerified
    - lastTransitionTime: "2024-10-29T09:30:11Z"
      reason: SuccessfullyCleanedVerificationSessionHistory
      status: "True"
      type: VerificationSessionHistoryCleaned
  duration: 11s
  phase: Succeeded

Here, we are going to describe the various sections of a BackupVerificationSession object.

BackupVerificationSession Metadata

metadata.name

metadata.name indicates the name of the BackupVerificationSession. This name is automatically generated by respective CronJob and it follows the following pattern: <Repository name>-<session name>-<creation timestamp in Unix epoch seconds>.

metadata.namespace

metadata.namespace indicates the name of the BackupVerificationSession. It is the same as the namespace of respective BackupConfiguration object.

If you create BackupVerificationSession manually to run verification instantly, make sure that you have provided a valid invoker at spec.invoker field to your BackupVerificationSession.

BackupVerificationSession Spec

A BackupVerificationSession object has the following fields in the spec section:

spec.invoker

spec.invoker specifies the apiGroup, kind, and name of the respective object which is responsible for invoking this backup verification session.

spec.session

spec.session specifies the name of the session that triggered this backup verification.

spec.repository

spec.repository specifies the name of the repository whose backed-up data will be verified.

spec.snapshot

spec.snapshot specifies the name of the snapshot that will be verified.

spec.retryLeft

spec.retryLeft specifies the number of retry attempt left for this backup verification session. If this set to non-zero, KubeStash will create a new BackupVerificationSession if the current one fails.

BackupVerificationSession Status

.status section of BackupVerificationSession shows stats and progress of backup verification process in this session. .status section consists of the following fields:

status.phase

status.phase indicates the overall phase of the backup verification process for this BackupVerificationSession.

status.duration

status.duration specifies the time required to complete the backup verification process.

status.retried

status.retried is a boolean field which specifies whether this session was retried or not in case of failed backup verification. This field will exist only if the retryConfig has been set in the respective backup invoker.

status.conditions

status.conditions shows the conditions of different operations/steps of the backup verification process. The following conditions are set by the KubeStash operator on a BackupVerificationSession.

Condition TypeUsage
BackupVerificationSkippedindicates that the current session was skipped.
VerificationSessionHistoryCleanedindicates whether the backup verification history was cleaned or not according to backupHistoryLimit.
VerificationExecutorEnsuredindicates whether the backup verification executor is ensured or not.
RestoreSucceededindicates whether the restore is succeeded or not.
BackupVerifiedindicates whether backup is verified or not.

Next Steps

  • Learn how backup of workloads data works from here.
  • Learn how backup stand alone PVC works from here.