Skip to content

Commit

Permalink
Add MSSQLServer backup/restore process by using KubeStash
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <[email protected]>
  • Loading branch information
anisurrahman75 committed Sep 30, 2024
1 parent e7907cb commit 7f9c118
Show file tree
Hide file tree
Showing 49 changed files with 3,900 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/guides/mssqlserver/backup/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Backup & Restore MSSQLServer
menu:
docs_{{ .version }}:
identifier: guides-mssqlserver-backup
name: Backup & Restore
parent: guides-mssqlserver
weight: 40
menu_name: docs_{{ .version }}
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
metadata:
name: sample-mssqlserver-backup
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: MSSQLServer
namespace: demo
name: sample-mssqlserver
backends:
- name: gcs-backend
storageRef:
namespace: demo
name: gcs-storage
retentionPolicy:
name: demo-retention
namespace: demo
sessions:
- name: frequent-backup
scheduler:
schedule: "*/5 * * * *"
jobTemplate:
backoffLimit: 1
repositories:
- name: gcs-mssqlserver-repo
backend: gcs-backend
directory: /mssqlserver
encryptionSecret:
name: encrypt-secret
namespace: demo
addon:
name: mssqlserver-addon
jobTemplate:
spec:
securityContext:
runAsUser: 0
tasks:
- name: manifest-backup
- name: logical-backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: gcs-storage
namespace: demo
spec:
storage:
provider: gcs
gcs:
bucket: kubestash-qa
prefix: demo
secretName: gcs-secret
usagePolicy:
allowedNamespaces:
from: All
default: true
# deletionPolicy: Delete
deletionPolicy: WipeOut
20 changes: 20 additions & 0 deletions docs/guides/mssqlserver/backup/application-level/examples/ca.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDLzCCAhegA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6PnfklKuSWgJsMl
5Vh7
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions docs/guides/mssqlserver/backup/application-level/examples/ca.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC3zLOX3a8XtVF+
hB3brUi+dpXNGSjAntX4o6TuKzyiu8k+9TylyiZLx94Zc3ark5csekLdBR5CSuCt
LPFvqWnnIBk8MDuP1VsLBxQgQl2OTJFfUk1a4E2bct06CacqNvRd3xrFgvWsj+Hr
Jzf3ah8YO56YsfpodF1xCDmoppJKRep1OwnNrx9wTeZU7fjfVxE8KoDwSoHwahkz
x87O/E/s7XOixU6wfNbbsRf/gvZr6FyZ0yIUUOSqHuXNSLVH/+G56l7D1D8m1rmo
aem4iNacf29h2kG/z2qI9s+YqEl+NKG3I9I+malhUq/AEPfSwt2a6HN7BZJFwad7
3HIrU5nPAgMBAAECggEAELTdmi8/TBNiHfLaV+5vT0iuIx9nUeLeJiSRyEhL0arq
Bvv5kERIqNi4+m1BWyUmN5fBXh+p+XKe637LT1AB3U1QneTwdQl6pgz1qlz97gJN
sHFlsJ30z+1n6G+aLz8hhSrTXyKhPBcz/NDqyGVwAB7jMpPy4+231J9fxlGluHRs
9xr9oiIyoAEKUyrQCZNv1TIEz1rS0jz2+URhi2Cjr8rmqme4cnpua8mVZBgkVOpP
BeWoFdPsjzPkKGv49exdW0wMxwSnXAXl0SF+zV+SsdM0vom5vEvqn7eo24Z2/DSH
sGj/Dc2xurVvqD7vJO8sQKw0qEgrzh47j5XcANwesQKBgQDksWiAxFgl1sj+oOJA
2tT0Sx7FipFDu4JrhavoQqYpWkIKCbGQcgPTqcbGpJSvwBONry4euVD1zd9MWBDp
wHNmFPtmL7LnHqqi1Rb5k+5GFMQ91pgkN0kehJaCFoDLKSdc7RhD1bD0ik1Sf7vZ
HnVpKThMsMnedMflOTLIp56o6QKBgQDNvwLZm837cF0jr98PMkyBj6DwlXv0HZ82
zWEZDcStwKuQkBQt4jYa81gRQDh5l/4RC7SzGdmKQFEpG9M3yYA5IlDoM8429JCS
HlgkD9+1NqRve0BidrR/hDatuIDb2/hYN2LcX9ood6cw6kWW3fluby0FjLNtEU6a
xkaqjtT59wKBgArXik/IfzFUDHVd5TwT49KtGQled2KRqi40ySCawEvnlofpS7zA
WwQW4XCbbt0iKwslifc06+yrVPHGnw6l7BKj3gNLMZ0ZbBeKKKuuYrZ514/i85WL
9XB38ra6IGMBUXdrWiIlKF1/jQjjO2GguwpARQYFv5xHRw7L9mdi4ve5AoGBAKPS
nttUctvtaUwcInlALKjRC23lKPCEkZyaReEkFGHhUvplrpumTjyBXLNHtnAjNPqv
nm8pewzZD4azECiQeleD2nY5oc4iR+cA4F++f/sTijT2J5r/N9N9G+iRS5FEgmcD
muUsMVIdi/On5kctcgmb3nZXxRpoOHWGwQfXeP+bAoGBAL/6AmacFk7e9i/Be5c2
fV9/X3sJPjk896lwoxPRfi08vpi1eBHLodLRXFT+RJ6c0rsR8aXCPH/ZoSzEomzC
yNiXLJCY7Y05RoCHKS4vWzcBJ7IAiE51Wqi81RTdr/ko3tYer6lCUqpyVunkP21H
RdmgfgsLF49phDSTkGY8pdnu
-----END PRIVATE KEY-----
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: mssqlserver-ca-issuer
namespace: demo
spec:
ca:
secretName: mssqlserver-ca
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: mssqlserver-ca-issuer
namespace: dev
spec:
ca:
secretName: mssqlserver-ca
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
name: restore-sample-mssqlserver
namespace: dev
spec:
manifestOptions:
msSQLServer:
db: true
restoreNamespace: dev
tlsIssuerRef:
name: mssqlserver-ca-issuer
kind: Issuer
apiGroup: cert-manager.io
dataSource:
namespace: demo
repository: gcs-mssqlserver-repo
snapshot: latest
encryptionSecret:
name: encrypt-secret
namespace: demo
addon:
name: mssqlserver-addon
jobTemplate:
spec:
securityContext:
runAsUser: 0
tasks:
- name: manifest-restore
- name: logical-backup-restore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
metadata:
name: demo-retention
namespace: demo
spec:
default: true
failedSnapshots:
last: 2
maxRetentionPeriod: 2mo
successfulSnapshots:
last: 5
usagePolicy:
allowedNamespaces:
from: All
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: kubedb.com/v1alpha2
kind: MSSQLServer
metadata:
name: sample-mssqlserver
namespace: demo
spec:
version: "2022-cu12"
replicas: 1
storageType: Durable
tls:
issuerRef:
name: mssqlserver-ca-issuer
kind: Issuer
apiGroup: "cert-manager.io"
clientTLS: false
storage:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
deletionPolicy: WipeOut
Loading

0 comments on commit 7f9c118

Please sign in to comment.