Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KubeStash connections and Layouts #404

Merged
merged 7 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions hub/resourcedescriptors/addons.kubestash.com/v1alpha1/addons.yaml
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
15 changes: 15 additions & 0 deletions hub/resourcedescriptors/batch/v1/cronjobs.yaml
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ metadata:
k8s.io/version: v1alpha1
name: core.kubestash.com-v1alpha1-backupsessions
spec:
connections:
- labels:
- source
level: Controller
target:
apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
type: OwnedBy
resource:
group: core.kubestash.com
kind: BackupSession
Expand Down
Loading
Loading