You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
New to KubeStash? Please start here.
Repository
What is Repository
A Repository is a Kubernetes CustomResourceDefinition(CRD) which represents the backup information for a specific application.
The KubeStash operator manages Repository objects, creating them based on information from a BackupConfiguration. When a BackupStorage is created with existing backup data, KubeStash automatically synchronizes the Repositories and Snapshots linked to it from the backend.
Repository CRD Specification
Like any official Kubernetes resource, a Repository object has TypeMeta, ObjectMeta, Spec and Status sections.
A sample Repository object that uses Google Cloud Storage(GCS) bucket as storage is shown below:
apiVersion: storage.kubestash.com/v1alpha1
kind: Repository
metadata:
name: gcs-demo-repo
namespace: demo
spec:
appRef:
apiGroup: apps
kind: StatefulSet
name: sample-sts
namespace: demo
deletionPolicy: Delete
encryptionSecret:
name: encrypt-secret
namespace: demo
path: /demo/data
storageRef:
name: gcs-storage
namespace: demo
status:
componentPaths:
- repository/v1/demo-session/pod-0
- repository/v1/demo-session/pod-1
- repository/v1/demo-session/pod-2
conditions:
- lastTransitionTime: "2023-12-07T06:37:40Z"
message: Successfully initialized repository
reason: RepositoryInitializationSucceeded
status: "True"
type: RepositoryInitialized
integrity: true
lastBackupTime: "2023-12-07T06:38:00Z"
phase: Ready
recentSnapshots:
- name: gcs-demo-repo-sample-backup-sts-demo-session-1701940920
phase: Succeeded
session: demo-session
size: 12.222 MiB
snapshotTime: "2023-12-07T06:38:10Z"
size: 12.222 MiB
snapshotCount: 1
Here, we are going to describe the various sections of the Repository crd.
Repository Spec
Repository CRD has the following fields in the .spec section:
- spec.appRef :
spec.AppRefrefers to the application that is being backed up in thisRepository. - spec.storageRef :
spec.storageRefrefers to theBackupStorageCR which contain the storage information where the backed up data will be stored. TheBackupStoragecould be in a different namespace. However, theRepositorynamespace must be allowed to use theBackupStorage. - spec.path :
spec.pathrepresents the directory inside theBackupStoragewhere this Repository is storing its data. This path is relative to the path ofBackupStorage. This path must be unique for eachRepositoryreferring sameBackupStorage. - spec.deletionPolicy :
spec.deletionPolicyspecifies what to do when aRepositoryCR is deleted. The valid values for this field are:- Delete : This will delete the respective
RepositoryCR and associatedSnapshotCRs from the cluster but keep the backed up data in the storage. This is the default behavior. - WipeOut : This will delete the respective
RepositoryCR, associatedSnapshotCRs and the backed up data inspec.pathfrom the storage.
- Delete : This will delete the respective
- spec.encryptionSecret : refers to the
Secretcontaining the encryption key which will be used to encode/decode the backed up data. You can refer to aSecretof a different namespace. - spec.paused :
spec.pausedspecifies whether the Repository is paused or not. If the Repository is paused, KubeStash will not process any further event for the Repository.
Repository Status
Repository crd shows the following statistics in .status section:
- status.phase :
status.phaserepresents the current state of theRepository. - status.lastBackupTime :
status.lastBackupTimespecifies the timestamp when the last successful backup has been taken. - status.integrity :
status.integrityspecifies whether the backed up data of thisRepositoryhas been corrupted or not. - status.snapshotCount :
status.snapshotCountspecifies the number of currentSnapshotsstored in thisRepository. - status.size :
status.sizespecifies the size of the backed up data stored in theRepository. - status.recentSnapshots :
status.recentSnapshotsholds a list of recentSnapshot(maximum 5) information that has been taken in thisRepository. - status.conditions :
status.conditionsrepresents list of conditions regarding thisRepository. The following condition is set by the KubeStash operator on aRepository.
| Condition Type | Usage |
|---|---|
RepositoryInitialized | indicates the Repository was initialized |
- status.componentPaths :
status.componentPathsrepresents list of component paths in thisRepository.






