diff --git a/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-addon.yaml b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-addon.yaml new file mode 100644 index 000000000..fec7e6387 --- /dev/null +++ b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-addon.yaml @@ -0,0 +1,122 @@ +{{ $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: + - name: args + required: false + usage: Arguments to be passed to the dump command. + - name: databases + required: false + usage: List of databases to backup. + - 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: VolumeSnapshotter + executor: Job + function: mariadb-csi-snapshotter + name: volume-snapshot + parameters: + - name: volumeSnapshotClassName + required: false + usage: The VolumeSnapshotClassName to be used by volumeSnapshot + singleton: true + - 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 }} diff --git a/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-backup.yaml b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-backup.yaml new file mode 100644 index 000000000..b0daf247b --- /dev/null +++ b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-backup.yaml @@ -0,0 +1,25 @@ +{{ $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:=} + - --databases=${databases:=} + image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/mariadb-restic-plugin") $) }}:v0.4.0-beta.1_${DB_VERSION}' +{{ end }} diff --git a/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-csi-snapshotter.yaml b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-csi-snapshotter.yaml new file mode 100644 index 000000000..c73f82284 --- /dev/null +++ b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-csi-snapshotter.yaml @@ -0,0 +1,20 @@ +{{ $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-csi-snapshotter' + labels: + {{- include "kubedb-kubestash-catalog.labels" . | nindent 4 }} +spec: + args: + - backup + - --namespace=${namespace:=default} + - --volume-snapshot-class-name=${volumeSnapshotClassName:=} + - --backupsession=${backupSession:=} + image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/mariadb-csi-snapshotter-plugin") $) }}:v0.2.0-beta.1' +{{ end }} diff --git a/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-restore.yaml b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-restore.yaml new file mode 100644 index 000000000..5a6ad578b --- /dev/null +++ b/charts/kubedb-kubestash-catalog/templates/mariadb/mariadb-restore.yaml @@ -0,0 +1,25 @@ +{{ $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-restore' + labels: + {{- include "kubedb-kubestash-catalog.labels" . | nindent 4 }} +spec: + args: + - restore + - --namespace=${namespace:=default} + - --restoresession=${restoreSession:=} + - --snapshot=${snapshot:=} + - --enable-cache=${enableCache:=} + - --scratch-dir=${scratchDir:=} + - --wait-timeout=${waitTimeout:={{ .Values.waitTimeout}}} + - --mariadb-args=${args:={{ .Values.mariadb.args }}} + - --db-version=${dbVersion:=} + image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/mariadb-restic-plugin") $) }}:v0.4.0-beta.1_${DB_VERSION}' +{{ end }} diff --git a/charts/kubedb-kubestash-catalog/values.yaml b/charts/kubedb-kubestash-catalog/values.yaml index e86b7d643..ee66dfbf8 100644 --- a/charts/kubedb-kubestash-catalog/values.yaml +++ b/charts/kubedb-kubestash-catalog/values.yaml @@ -91,6 +91,14 @@ mysql: restore: # Arguments to pass to `mysql` command during restore process args: "" +mariadb: + # optional argument to send mariadbdump or mariadb command + backup: + # Arguments to pass to `mariadbdump` command during bakcup process + args: "" + restore: + # Arguments to pass to `mariadb` command during restore process + args: "" redis: # optional argument to send redis-dump or redis command backup: