Skip to content

Commit b561ed3

Browse files
committed
doc
Signed-off-by: wenting <wentingwu@microsoft.com>
1 parent bf52fb6 commit b561ed3

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

operator/src/internal/controller/backup_controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ func (r *BackupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
9393
if !replicationContext.IsPrimary() {
9494
return r.SetBackupPhaseSkipped(ctx, backup, "Backups can only be created from the primary cluster", cluster.Spec.Backup)
9595
}
96+
if !replicationContext.EndpointEnabled() {
97+
logger.Info("Backup deferred: primary cluster endpoint not ready, waiting for promotion to complete")
98+
return ctrl.Result{RequeueAfter: time.Minute * 1}, nil
99+
}
96100

97101
return r.createCNPGBackup(ctx, backup, cluster)
98102
}

operator/src/scripts/aks-fleet-deployment/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,79 @@ az network vnet peering list --resource-group german-aks-fleet-rg \
258258
--vnet-name member-westus3-vnet --output table
259259
```
260260

261+
## Backup and Restore
262+
### Backup
263+
264+
Create a one-time backup:
265+
```bash
266+
kubectl --context hub apply -f - <<EOF
267+
apiVersion: db.microsoft.com/preview
268+
kind: Backup
269+
metadata:
270+
name: backup-documentdb
271+
namespace: documentdb-preview-ns
272+
spec:
273+
cluster:
274+
name: documentdb-preview
275+
EOF
276+
```
277+
278+
Create automatic backups on a schedule:
279+
```bash
280+
kubectl --context hub apply -f - <<EOF
281+
apiVersion: db.microsoft.com/preview
282+
kind: ScheduledBackup
283+
metadata:
284+
name: scheduled-backup
285+
namespace: documentdb-preview-ns
286+
spec:
287+
cluster:
288+
name: documentdb-preview
289+
schedule: "0 2 * * *" # Daily at 2 AM
290+
EOF
291+
```
292+
293+
Backups will be created on the primary cluster.
294+
295+
### Restore
296+
297+
Step 1: Identify Available Backups
298+
```bash
299+
PRIMARY_CLUSTER=$(kubectl --context hub get documentdb documentdb-preview -n documentdb-preview-ns -o jsonpath='{.spec.clusterReplication.primary}')
300+
301+
kubectl --context $PRIMARY_CLUSTER get backups -n documentdb-preview-ns
302+
```
303+
304+
Step 2: Modify multi-region.yaml for Restore
305+
306+
Important: Restores must be to a new DocumentDB resource with a different name.
307+
308+
Edit `./multi-region.yaml` and change:
309+
1. The DocumentDB resource name (e.g., documentdb-preview-restore)
310+
2. Add the bootstrap section with backup reference
311+
312+
Example:
313+
```yaml
314+
apiVersion: db.microsoft.com/preview
315+
kind: DocumentDB
316+
metadata:
317+
name: documentdb-preview-restore # New name, different from original
318+
namespace: documentdb-preview-ns
319+
spec:
320+
...
321+
bootstrap:
322+
recovery:
323+
backup:
324+
name: scheduled-backup-xxxxxx # Name of the backup to restore from
325+
```
326+
327+
Step 3: Deploy the Restored Cluster
328+
329+
Run the deployment script:
330+
```bash
331+
./deploy-multi-region.sh "${DOCUMENTDB_PASSWORD}"
332+
```
333+
261334
## Troubleshooting
262335

263336
### Authentication Issues

0 commit comments

Comments
 (0)