Skip to content

Commit

Permalink
Add manifests for OVN NB and SB backup.
Browse files Browse the repository at this point in the history
  • Loading branch information
awfabian-rs committed Feb 1, 2024
1 parent e5d1192 commit a47d21b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions kustomize/ovn/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
resources:
- ovn-setup.yaml
- ovn-backup.yaml
57 changes: 57 additions & 0 deletions kustomize/ovn/ovn-backup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This writes OVN NB and SB snapshots to a persistent volume, assuming you
# installed OVN with kubespray, since it assumes resources exist as seen in the
# genestack/submodules/kubespray/roles/network_plugin/kube-ovn/templates
# directory, assuming you have checked out the genestack submodules.
# (For instance, it uses the `ovn` service account as seen in
# genestack/submodules/kubespray/roles/network_plugin/kube-ovn/templates/cni-ovn.yml.j2
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: kube-system
name: ovndb-backup
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: general
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: ovn-snapshot-cron
namespace: kube-system
spec:
schedule: "0 0 * * *"
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
jobTemplate:
spec:
backoffLimit: 5
template:
spec:
serviceAccount: "ovn"
serviceAccountName: "ovn"
restartPolicy: "Never"
volumes:
- name: backup
persistentVolumeClaim:
claimName: ovndb-backup
containers:
- name: ovn-central-backup
env:
- name: RETENTION_DAYS
value: "30"
command: ["/bin/sh", "-c"]
args:
- >
find /backup -ctime +$RETENTION_DAYS -delete;
/kube-ovn/kubectl-ko nb backup;
/kube-ovn/kubectl-ko sb backup;
mv /kube-ovn/ovn*db*.backup /backup;
image: docker.io/kubeovn/kube-ovn:v1.11.5
imagePullPolicy: IfNotPresent
volumeMounts:
- name: backup
mountPath: "/backup"

0 comments on commit a47d21b

Please sign in to comment.