Skip to content

Commit

Permalink
Cross cluster backup (#205)
Browse files Browse the repository at this point in the history
* Add guide for cross-cluster backup and restore.

Signed-off-by: piyush1146115 <[email protected]>

* Update cross-cluster-backup and cross-namespace-backup doc.

Signed-off-by: piyush1146115 <[email protected]>

* Update cross-cluster-backup doc.

Signed-off-by: piyush1146115 <[email protected]>

* Fix grammatical errors.

Signed-off-by: piyush1146115 <[email protected]>

* Update cross cluster backup doc according to the review.

Signed-off-by: piyush1146115 <[email protected]>

* Update advance-use-case docs.

Signed-off-by: piyush1146115 <[email protected]>

* Fix heading.

Signed-off-by: piyush1146115 <[email protected]>

* Update cross cluster backup doc.

Signed-off-by: piyush1146115 <[email protected]>

* Fix formatting errors.

Signed-off-by: piyush1146115 <[email protected]>

* Fix heading.

Signed-off-by: piyush1146115 <[email protected]>

Co-authored-by: Emruz Hossain <[email protected]>
  • Loading branch information
piyush1146115 and Emruz Hossain authored Mar 16, 2022
1 parent 6a9e850 commit 7aae0d2
Show file tree
Hide file tree
Showing 13 changed files with 790 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
metadata:
name: deployment-backup
namespace: demo
spec:
repository:
name: gcs-repo
schedule: "*/5 * * * *"
target:
ref:
apiVersion: apps/v1
kind: Deployment
name: stash-demo
volumeMounts:
- name: source-data
mountPath: /source/data
paths:
- /source/data
retentionPolicy:
name: 'keep-last-5'
keepLast: 5
prune: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: stash-sample-data
namespace: demo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: stash-demo
name: stash-demo
namespace: demo
spec:
replicas: 3
selector:
matchLabels:
app: stash-demo
template:
metadata:
labels:
app: stash-demo
name: busybox
spec:
containers:
- args: ["echo sample_data > /source/data/data.txt && sleep 3000"]
command: ["/bin/sh", "-c"]
image: busybox
imagePullPolicy: IfNotPresent
name: busybox
volumeMounts:
- mountPath: /source/data
name: source-data
restartPolicy: Always
volumes:
- name: source-data
persistentVolumeClaim:
claimName: stash-sample-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: stash-sample-data
namespace: demo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: stash-recovered
name: stash-recovered
namespace: demo
spec:
replicas: 3
selector:
matchLabels:
app: stash-recovered
template:
metadata:
labels:
app: stash-recovered
name: busybox
spec:
containers:
- args:
- sleep
- "3600"
image: busybox
imagePullPolicy: IfNotPresent
name: busybox
volumeMounts:
- mountPath: /source/data
name: source-data
restartPolicy: Always
volumes:
- name: source-data
persistentVolumeClaim:
claimName: demo-pvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: stash-sample-data
namespace: demo
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: demo-pvc
namespace: demo
spec:
accessModes:
- ReadWriteOnce
storageClassName: standard
resources:
requests:
storage: 1Gi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: gcs-repo
namespace: demo
spec:
backend:
gcs:
bucket: stash-testing
prefix: /cross-cluster/deployment/sample-deployment
storageSecretName: gcs-secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
name: gcs-repo
namespace: demo
spec:
backend:
gcs:
bucket: stash-testing
prefix: /cross-cluster/deployment/sample-deployment
storageSecretName: gcs-secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: stash.appscode.com/v1beta1
kind: RestoreSession
metadata:
name: deployment-restore
namespace: demo
spec:
repository:
name: gcs-repo
target: # target indicates where the recovered data will be stored
ref:
apiVersion: apps/v1
kind: Deployment
name: stash-recovered
volumeMounts:
- name: source-data
mountPath: /source/data
rules:
- paths:
- /source/data/
Loading

0 comments on commit 7aae0d2

Please sign in to comment.