-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MariaDB Addon for Backup and Restore with Restic (#876)
Signed-off-by: SK Ali Arman <[email protected]> Signed-off-by: hmsayem <[email protected]> Co-authored-by: hmsayem <[email protected]>
- Loading branch information
1 parent
0ba427b
commit bf44eef
Showing
12 changed files
with
404 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
apiVersion: addons.kubestash.com/v1alpha1 | ||
kind: Addon | ||
metadata: | ||
name: mariadb-addon | ||
spec: | ||
backupTasks: | ||
- name: logical-backup | ||
function: mariadb-backup | ||
driver: Restic | ||
executor: Job | ||
singleton: true | ||
parameters: | ||
- name: args | ||
usage: Arguments to be passed to the dump command. | ||
required: false | ||
default: "--all-databases" | ||
- name: enableCache | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
required: false | ||
default: "true" | ||
- name: scratchDir | ||
usage: Directory for holding temporary files and restic cache. | ||
required: false | ||
default: /kubestash-tmp | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
usage: Holds temporary files and restic cache. | ||
source: | ||
emptyDir: { } | ||
volumeMounts: | ||
- name: kubestash-tmp-volume | ||
mountPath: /kubestash-tmp | ||
- name: manifest-backup | ||
function: kubedbmanifest-backup | ||
driver: Restic | ||
executor: Job | ||
singleton: true | ||
parameters: | ||
- name: enableCache | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
required: false | ||
default: "true" | ||
- name: scratchDir | ||
usage: Directory for holding temporary files and restic cache. | ||
required: false | ||
default: /kubestash-tmp | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
usage: Holds temporary files and restic cache. | ||
source: | ||
emptyDir: { } | ||
volumeMounts: | ||
- name: kubestash-tmp-volume | ||
mountPath: /kubestash-tmp | ||
restoreTasks: | ||
- name: logical-backup-restore | ||
function: mariadb-restore | ||
driver: Restic | ||
executor: Job | ||
singleton: true | ||
parameters: | ||
- name: args | ||
usage: Arguments to be passed to the dump command. | ||
required: false | ||
- name: enableCache | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
required: false | ||
default: "true" | ||
- name: scratchDir | ||
usage: Directory for holding temporary files and restic cache. | ||
required: false | ||
default: /kubestash-tmp | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
usage: Holds temporary files and restic cache. | ||
source: | ||
emptyDir: { } | ||
volumeMounts: | ||
- name: kubestash-tmp-volume | ||
mountPath: /kubestash-tmp | ||
- name: manifest-restore | ||
function: kubedbmanifest-restore | ||
driver: Restic | ||
executor: Job | ||
singleton: true | ||
parameters: | ||
- name: enableCache | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
required: false | ||
default: "true" | ||
- name: scratchDir | ||
usage: Directory for holding temporary files and restic cache. | ||
required: false | ||
default: /kubestash-tmp | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
usage: Holds temporary files and restic cache. | ||
source: | ||
emptyDir: { } | ||
volumeMounts: | ||
- name: kubestash-tmp-volume | ||
mountPath: /kubestash-tmp |
15 changes: 15 additions & 0 deletions
15
catalog/kubestash/raw/mariadb/mariadb-backup-function.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: addons.kubestash.com/v1alpha1 | ||
kind: Function | ||
metadata: | ||
name: mariadb-backup | ||
spec: | ||
args: | ||
- backup | ||
- --namespace=${namespace:=default} | ||
- --backupsession=${backupSession:=} | ||
- --enable-cache=${enableCache:=} | ||
- --scratch-dir=${scratchDir:=} | ||
- --wait-timeout=${waitTimeout:=300} | ||
- --mariadb-args=${args:=} | ||
- --db-version=${dbVersion:=} | ||
image: skaliarman/mariadb-restic-plugin:restic-backup_linux_amd64test12 |
16 changes: 16 additions & 0 deletions
16
catalog/kubestash/raw/mariadb/mariadb-restore-function.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: addons.kubestash.com/v1alpha1 | ||
kind: Function | ||
metadata: | ||
name: mariadb-restore | ||
spec: | ||
args: | ||
- restore | ||
- --namespace=${namespace:=default} | ||
- --restoresession=${restoreSession:=} | ||
- --snapshot=${snapshot:=} | ||
- --enable-cache=${enableCache:=} | ||
- --scratch-dir=${scratchDir:=} | ||
- --wait-timeout=${waitTimeout:=300} | ||
- --mariadb-args=${args:=} | ||
- --db-version=${dbVersion:=} | ||
image: skaliarman/mariadb-restic-plugin:restic-backup_linux_amd64test12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-addon.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{{ $featureGates := .Values.featureGates }} | ||
{{- if .Values.global }} | ||
{{ $featureGates = mergeOverwrite dict .Values.featureGates .Values.global.featureGates }} | ||
{{- end }} | ||
|
||
{{ if $featureGates.MariaDB }} | ||
apiVersion: addons.kubestash.com/v1alpha1 | ||
kind: Addon | ||
metadata: | ||
name: 'mariadb-addon' | ||
labels: | ||
{{- include "kubedb-kubestash-catalog.labels" . | nindent 4 }} | ||
spec: | ||
backupTasks: | ||
- driver: Restic | ||
executor: Job | ||
function: mariadb-backup | ||
name: logical-backup | ||
parameters: | ||
- default: --all-databases | ||
name: args | ||
required: false | ||
usage: Arguments to be passed to the dump command. | ||
- default: "true" | ||
name: enableCache | ||
required: false | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
- default: /kubestash-tmp | ||
name: scratchDir | ||
required: false | ||
usage: Directory for holding temporary files and restic cache. | ||
singleton: true | ||
volumeMounts: | ||
- mountPath: /kubestash-tmp | ||
name: kubestash-tmp-volume | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
source: | ||
emptyDir: {} | ||
usage: Holds temporary files and restic cache. | ||
- driver: Restic | ||
executor: Job | ||
function: kubedbmanifest-backup | ||
name: manifest-backup | ||
parameters: | ||
- default: "true" | ||
name: enableCache | ||
required: false | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
- default: /kubestash-tmp | ||
name: scratchDir | ||
required: false | ||
usage: Directory for holding temporary files and restic cache. | ||
singleton: true | ||
volumeMounts: | ||
- mountPath: /kubestash-tmp | ||
name: kubestash-tmp-volume | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
source: | ||
emptyDir: {} | ||
usage: Holds temporary files and restic cache. | ||
restoreTasks: | ||
- driver: Restic | ||
executor: Job | ||
function: mariadb-restore | ||
name: logical-backup-restore | ||
parameters: | ||
- name: args | ||
required: false | ||
usage: Arguments to be passed to the dump command. | ||
- default: "true" | ||
name: enableCache | ||
required: false | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
- default: /kubestash-tmp | ||
name: scratchDir | ||
required: false | ||
usage: Directory for holding temporary files and restic cache. | ||
singleton: true | ||
volumeMounts: | ||
- mountPath: /kubestash-tmp | ||
name: kubestash-tmp-volume | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
source: | ||
emptyDir: {} | ||
usage: Holds temporary files and restic cache. | ||
- driver: Restic | ||
executor: Job | ||
function: kubedbmanifest-restore | ||
name: manifest-restore | ||
parameters: | ||
- default: "true" | ||
name: enableCache | ||
required: false | ||
usage: Enable or disable caching. Disabling caching may impact backup performance. | ||
- default: /kubestash-tmp | ||
name: scratchDir | ||
required: false | ||
usage: Directory for holding temporary files and restic cache. | ||
singleton: true | ||
volumeMounts: | ||
- mountPath: /kubestash-tmp | ||
name: kubestash-tmp-volume | ||
volumeTemplate: | ||
- name: kubestash-tmp-volume | ||
source: | ||
emptyDir: {} | ||
usage: Holds temporary files and restic cache. | ||
{{ end }} |
24 changes: 24 additions & 0 deletions
24
charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-backup.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{ $featureGates := .Values.featureGates }} | ||
{{- if .Values.global }} | ||
{{ $featureGates = mergeOverwrite dict .Values.featureGates .Values.global.featureGates }} | ||
{{- end }} | ||
|
||
{{ if $featureGates.MariaDB }} | ||
apiVersion: addons.kubestash.com/v1alpha1 | ||
kind: Function | ||
metadata: | ||
name: 'mariadb-backup' | ||
labels: | ||
{{- include "kubedb-kubestash-catalog.labels" . | nindent 4 }} | ||
spec: | ||
args: | ||
- backup | ||
- --namespace=${namespace:=default} | ||
- --backupsession=${backupSession:=} | ||
- --enable-cache=${enableCache:=} | ||
- --scratch-dir=${scratchDir:=} | ||
- --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}} | ||
- --mariadb-args=${args:={{ .Values.mariadb.args }}} | ||
- --db-version=${dbVersion:=} | ||
image: '{{ include "image.dockerHub" (merge (dict "_repo" "skaliarman/mariadb-restic-plugin") $) }}:restic-backup_linux_amd64test12' | ||
{{ end }} |
Oops, something went wrong.