Skip to content

Commit

Permalink
Add kubestash support
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Mar 12, 2024
1 parent 0db8269 commit a5f6c53
Show file tree
Hide file tree
Showing 44 changed files with 970 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
kmodules.xyz/custom-resources v0.29.1
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/resource-metadata v0.18.2-0.20240308063426-55b6bfc539a9
kmodules.xyz/resource-metadata v0.18.2-0.20240312054834-7f4fd865b2ce
kmodules.xyz/resource-metrics v0.29.1
kmodules.xyz/sets v0.29.0
kubeops.dev/falco-ui-server v0.0.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3488,8 +3488,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.0 h1:GHLhxxT9jU1N8+FvOCCeJNyU5g0duYS46UGrs6AHNLY=
kmodules.xyz/offshoot-api v0.29.0/go.mod h1:5NxhBblXoDHWStx9HCDJR2KFTwYjEZ7i1Id3jelIunw=
kmodules.xyz/resource-metadata v0.18.2-0.20240308063426-55b6bfc539a9 h1:NxTZYyzeSnt2uAQOUz+2Cpkl9kwlaYjoyLeOb/OUBuU=
kmodules.xyz/resource-metadata v0.18.2-0.20240308063426-55b6bfc539a9/go.mod h1:Vb2bFCOX4uz2TsRRMzTkUqFWWOjJ261lY8Hs2HWgzh4=
kmodules.xyz/resource-metadata v0.18.2-0.20240312054834-7f4fd865b2ce h1:1rRGXwMp9bVeLhxHBcxbvrdrZitKg+sWqn18ZnM0oxQ=
kmodules.xyz/resource-metadata v0.18.2-0.20240312054834-7f4fd865b2ce/go.mod h1:Vb2bFCOX4uz2TsRRMzTkUqFWWOjJ261lY8Hs2HWgzh4=
kmodules.xyz/resource-metrics v0.29.1 h1:gP4SNosdDGFImpne52mnQtHacmnllYkTMcYL//p/ltM=
kmodules.xyz/resource-metrics v0.29.1/go.mod h1:OuG/QobZ7o8GFHl/u3lqaUR0fDZDegxtV8Vdh+MNBD4=
kmodules.xyz/sets v0.29.0 h1:ZX/qOECzUob95JhhRtngJElHSlJ1UNNdwK4hTEy+nl0=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
labels:
k8s.io/group: core.kubestash.com
k8s.io/kind: BackupBatch
k8s.io/resource: backupbatches
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupbatches
spec:
blocks: null
resource:
group: core.kubestash.com
kind: BackupBatch
name: backupbatches
scope: Namespaced
version: v1alpha1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
labels:
k8s.io/group: core.kubestash.com
k8s.io/kind: BackupBlueprint
k8s.io/resource: backupblueprints
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupblueprints
spec:
blocks: null
resource:
group: core.kubestash.com
kind: BackupBlueprint
name: backupblueprints
scope: Namespaced
version: v1alpha1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
labels:
k8s.io/group: core.kubestash.com
k8s.io/kind: BackupConfiguration
k8s.io/resource: backupconfigurations
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupconfigurations
spec:
blocks:
- actions:
create: Never
displayMode: List
kind: Connection
name: Backup Sessions
query:
byLabel: source
type: GraphQL
ref:
group: core.kubestash.com
kind: BackupSession
- actions:
create: Never
displayMode: List
kind: Connection
name: Retention Policies
query:
byLabel: policy
type: GraphQL
ref:
group: storage.kubestash.com
kind: RetentionPolicy
- actions:
create: Never
displayMode: List
kind: Connection
name: CronJobs
query:
byLabel: offshoot
type: GraphQL
ref:
group: batch
kind: CronJob
resource:
group: core.kubestash.com
kind: BackupConfiguration
name: backupconfigurations
scope: Namespaced
version: v1alpha1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
labels:
k8s.io/group: core.kubestash.com
k8s.io/kind: HookTemplate
k8s.io/resource: hooktemplates
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-hooktemplates
spec:
blocks: null
resource:
group: core.kubestash.com
kind: HookTemplate
name: hooktemplates
scope: Namespaced
version: v1alpha1
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
name: core.kubestash.com-v1alpha1-kubedb-backup
spec:
blocks:
- actions:
create: Always
displayMode: List
kind: Connection
name: Recent Backups
query:
raw: |-
query Find($src: String!, $targetGroup: String!, $targetKind: String!) {
find(oid: $src) {
backup_via(group: "core.kubestash.com", kind: "BackupConfiguration") {
refs: source(group: $targetGroup, kind: $targetKind) {
namespace
name
}
}
}
}
type: GraphQL
ref:
group: core.kubestash.com
kind: BackupSession
- actions:
create: Always
displayMode: List
kind: Connection
name: Recent Restores
query:
byLabel: restore_into
type: GraphQL
ref:
group: core.kubestash.com
kind: RestoreSession
- actions:
create: IfEmpty
displayMode: List
kind: Connection
name: Backup Configuration
query:
byLabel: backup_via
type: GraphQL
ref:
group: core.kubestash.com
kind: BackupConfiguration
- actions:
create: IfEmpty
displayMode: List
kind: Connection
name: Repository
query:
byLabel: backup_via
type: GraphQL
ref:
group: storage.kubestash.com
kind: Repository
- actions:
create: Never
displayMode: List
kind: Connection
name: CronJobs
query:
raw: |-
query Find($src: String!, $targetGroup: String!, $targetKind: String!) {
find(oid: $src) {
backup_via(group: "core.kubestash.com", kind: "BackupConfiguration") {
refs: offshoot(group: $targetGroup, kind: $targetKind) {
namespace
name
}
}
}
}
type: GraphQL
ref:
group: batch
kind: CronJob
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: meta.k8s.appscode.com/v1alpha1
kind: ResourceBlockDefinition
metadata:
creationTimestamp: null
labels:
k8s.io/group: core.kubestash.com
k8s.io/kind: RestoreSession
k8s.io/resource: restoresessions
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-restoresessions
spec:
blocks: null
resource:
group: core.kubestash.com
kind: RestoreSession
name: restoresessions
scope: Namespaced
version: v1alpha1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ metadata:
k8s.io/version: v1alpha1
name: addons.kubestash.com-v1alpha1-addons
spec:
connections:
- labels:
- source
references:
- '{range .spec.backupTasks[*]}{.function}{"\n"}{end}'
- '{range .spec.restoreTasks[*]}{.function}{"\n"}{end}'
target:
apiVersion: addons.kubestash.com/v1alpha1
kind: Function
type: MatchRef
resource:
group: addons.kubestash.com
kind: Addon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ metadata:
k8s.io/version: v1
name: batch-v1-cronjobs
spec:
connections:
- labels:
- offshoot
level: Controller
target:
apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
type: OwnedBy
- labels:
- offshoot
level: Controller
target:
apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
type: OwnedBy
resource:
group: batch
kind: CronJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ metadata:
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupblueprints
spec:
connections:
- labels:
- policy
namespace:
path: metadata.namespace
references:
- '{range .spec.backupConfigurationTemplate.backends[*]}{.retentionPolicy.name}{"\n"}{end}'
target:
apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
type: MatchRef
- labels:
- storage
namespace:
path: metadata.namespace
references:
- '{range .spec.backupConfigurationTemplate.backends[*]}{.storageRef.name}{"\n"}{end}'
target:
apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
type: MatchRef
resource:
group: core.kubestash.com
kind: BackupBlueprint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,97 @@ metadata:
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupconfigurations
spec:
connections:
- labels:
- storage
namespace:
path: metadata.namespace
references:
- '{range .spec.backends[*]}{.storageRef.name},{.storageRef.name}{"\n"}{end}'
target:
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
type: MatchRef
- labels:
- policy
references:
- '{range .spec.backends[*]}{.retentionPolicy.name},{.retentionPolicy.namespace}{"\n"}{end}'
target:
apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: Postgres
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: Redis
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: Elasticsearch
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: Kafka
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: MariaDB
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: MongoDB
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: MySQL
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: PerconaXtraDB
type: MatchRef
- labels:
- backup_via
references:
- '{.spec.target.name},{.spec.target.namespace},{.spec.target.kind},{.spec.target.apiGroup}'
target:
apiVersion: kubedb.com/v1alpha2
kind: RedisSentinel
type: MatchRef
resource:
group: core.kubestash.com
kind: BackupConfiguration
Expand Down
Loading

0 comments on commit a5f6c53

Please sign in to comment.