Skip to content

Commit

Permalink
Add WAL-G related tasks to kubestash catalog (#713)
Browse files Browse the repository at this point in the history
Signed-off-by: hmsayem <[email protected]>
  • Loading branch information
hmsayem authored Nov 28, 2023
1 parent 4025c3d commit 60791ac
Show file tree
Hide file tree
Showing 13 changed files with 314 additions and 149 deletions.
28 changes: 16 additions & 12 deletions apis/installer/v1alpha1/kubedb_kubestash_catalog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ type KubedbKubestashCatalogSpec struct {
Elasticsearch StashElasticsearchSpec `json:"elasticsearch"`
Opensearch StashOpensearchSpec `json:"opensearch"`
Kubedbmanifest StashKubedbmanifestSpec `json:"kubedbmanifest"`
KubeDump KubeDumpSpec `json:"kubedump"`
Mongodb StashMongodbSpec `json:"mongodb"`
Mysql StashMysqlSpec `json:"mysql"`
Pvc StashPvcSpec `json:"pvc"`
Redis StashRedisSpec `json:"redis"`
Volumesnapshot StashVolumesnapshotSpec `json:"volumesnapshot"`
Workload StashWorkloadSpec `json:"workload"`
Postgres StashPostgresSpec `json:"postgres"`
}

// StashElasticsearchSpec is the schema for Stash Elasticsearch values file
Expand Down Expand Up @@ -142,10 +139,6 @@ type MySQLRestore struct {
Args string `json:"args"`
}

type StashPvcSpec struct {
Enabled bool `json:"enabled"`
}

// StashRedisSpec is the schema for Stash Redis values file
type StashRedisSpec struct {
Enabled bool `json:"enabled"`
Expand All @@ -163,12 +156,23 @@ type RedisRestore struct {
Args string `json:"args"`
}

type StashVolumesnapshotSpec struct {
Enabled bool `json:"enabled"`
// StashPostgresSpec is the schema for Stash Postgres values file
type StashPostgresSpec struct {
Enabled bool `json:"enabled"`
Backup PostgresBackup `json:"backup"`
Restore PostgresRestore `json:"restore"`
}

type StashWorkloadSpec struct {
Enabled bool `json:"enabled"`
type PostgresBackup struct {
// +optional
CMD string `json:"cmd"`
// +optional
Args string `json:"args"`
}

type PostgresRestore struct {
// +optional
Args string `json:"args"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
79 changes: 39 additions & 40 deletions apis/installer/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions catalog/kubestash/raw/mongodb/mongodb-addon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ spec:
volumeMounts:
- name: kubestash-tmp-volume
mountPath: /kubestash-tmp
- name: VolumeSnapshot
function: mongodb-csisnapshotter
driver: VolumeSnapshotter
executor: Job
singleton: true
parameters:
- name: volumeSnapshotClassName
usage: The VolumeSnapshotClassName to be used by volumeSnapshot
required: false
- name: ManifestBackup
function: kubedbmanifest-backup
driver: Restic
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: addons.kubestash.com/v1alpha1
kind: Function
metadata:
name: mongodb-csisnapshotter
spec:
args:
- backup
- --namespace=${namespace:=default}
- --volume-snapshot-class-name=${volumeSnapshotClassName:=}
- --backupsession=${backupSession:=}
image: ghcr.io/kubedb/mongodb-csi-snapshotter-plugin:v0.0.1
60 changes: 60 additions & 0 deletions catalog/kubestash/raw/postgres/postgres-addon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: addons.kubestash.com/v1alpha1
kind: Addon
metadata:
name: postgres-addon
spec:
backupTasks:
- name: VolumeSnapshot
function: postgres-csisnapshotter
driver: VolumeSnapshotter
executor: Job
singleton: true
parameters:
- name: volumeSnapshotClassName
usage: The VolumeSnapshotClassName to be used by volumeSnapshot
required: false
- name: ManifestBackup
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: ManifestRestore
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: addons.kubestash.com/v1alpha1
kind: Function
metadata:
name: postgres-csisnapshotter
spec:
args:
- backup
- --namespace=${namespace:=default}
- --volume-snapshot-class-name=${volumeSnapshotClassName:=}
- --backupsession=${backupSession:=}
image: ghcr.io/kubedb/postgres-csi-snapshotter-plugin:v0.0.1
Loading

0 comments on commit 60791ac

Please sign in to comment.