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.AppRef
refers to the application that is being backed up in thisRepository
. - spec.storageRef :
spec.storageRef
refers to theBackupStorage
CR which contain the storage information where the backed up data will be stored. TheBackupStorage
could be in a different namespace. However, theRepository
namespace must be allowed to use theBackupStorage
. - spec.path :
spec.path
represents the directory inside theBackupStorage
where this Repository is storing its data. This path is relative to the path ofBackupStorage
. This path must be unique for eachRepository
referring sameBackupStorage
. - spec.deletionPolicy :
spec.deletionPolicy
specifies what to do when aRepository
CR is deleted. The valid values for this field are:- Delete : This will delete the respective
Repository
CR and associatedSnapshot
CRs from the cluster but keep the backed up data in the storage. This is the default behavior. - WipeOut : This will delete the respective
Repository
CR, associatedSnapshot
CRs and the backed up data inspec.path
from the storage.
- Delete : This will delete the respective
- spec.encryptionSecret : refers to the
Secret
containing the encryption key which will be used to encode/decode the backed up data. You can refer to aSecret
of a different namespace. - spec.paused :
spec.paused
specifies 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.phase
represents the current state of theRepository
. - status.lastBackupTime :
status.lastBackupTime
specifies the timestamp when the last successful backup has been taken. - status.integrity :
status.integrity
specifies whether the backed up data of thisRepository
has been corrupted or not. - status.snapshotCount :
status.snapshotCount
specifies the number of currentSnapshots
stored in thisRepository
. - status.size :
status.size
specifies the size of the backed up data stored in theRepository
. - status.recentSnapshots :
status.recentSnapshots
holds a list of recentSnapshot
(maximum 5) information that has been taken in thisRepository
. - status.conditions :
status.conditions
represents 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.componentPaths
represents list of component paths in thisRepository
.