Skip to content

Commit

Permalink
chore: adapt bpt with new API (#1079)
Browse files Browse the repository at this point in the history
Co-authored-by: wangyelei <[email protected]>
  • Loading branch information
wangyelei and wangyelei authored Oct 12, 2024
1 parent 07c65ad commit c47979c
Show file tree
Hide file tree
Showing 19 changed files with 437 additions and 467 deletions.
24 changes: 10 additions & 14 deletions addons/apecloud-mysql/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: {{ include "apecloud-mysql.backupPolicyTemplateName" . }}
labels:
clusterdefinition.kubeblocks.io/name: apecloud-mysql
service-kind/mysql: "true"
{{- include "apecloud-mysql.labels" . | nindent 4 }}
annotations:
dataprotection.kubeblocks.io/is-default-policy-template: "true"
spec:
backupPolicies:
- componentDefs:
- {{ include "apecloud-mysql.componentDefName" . }}
target:
role: follower
fallbackRole: leader
account: root
backupMethods:
serviceKind: ApeCloudMySQL
compDefs:
- {{ include "apecloud-mysql.componentDefName" . }}
target:
role: follower
fallbackRole: leader
account: root
backupMethods:
- name: xtrabackup
snapshotVolumes: false
actionSetName: {{ include "apecloud-mysql.xtrabackupActionSetName" . }}
Expand All @@ -33,7 +29,7 @@ spec:
volumeMounts:
- name: data
mountPath: {{ .Values.mysqlConfigs.dataMountPath }}
schedules:
schedules:
- backupMethod: xtrabackup
enabled: false
cronExpression: "0 18 * * *"
Expand Down
21 changes: 9 additions & 12 deletions addons/apecloud-mysql/templates/backuppolicytemplateforhscale.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: {{ include "apecloud-mysql.hscaleBackupPolicyTemplateName" . }}
labels:
clusterdefinition.kubeblocks.io/name: apecloud-mysql
service-kind/mysql: "true"
{{- include "apecloud-mysql.labels" . | nindent 4 }}
spec:
identifier: hscale
backupPolicies:
- componentDefs:
- {{ include "apecloud-mysql.componentDefName" . }}
target:
role: follower
fallbackRole: leader
account: root
backupMethods:
serviceKind: ApeCloudMySQL
compDefs:
- {{ include "apecloud-mysql.componentDefName" . }}
target:
role: follower
fallbackRole: leader
account: root
backupMethods:
- name: volume-snapshot
snapshotVolumes: true
actionSetName: {{ include "apecloud-mysql.vsActionSetName" . }}
Expand Down
11 changes: 5 additions & 6 deletions addons/elasticsearch/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: elasticsearch-backup-policy-template
labels:
clusterdefinition.kubeblocks.io/name: elasticsearch
{{- include "elasticsearch.labels" . | nindent 4 }}
spec:
backupPolicies:
- componentDefs:
serviceKind: Elasticsearch
compDefs:
- elasticsearch
backupMethods:
backupMethods:
- name: full-backup
target:
role: ""
Expand All @@ -26,7 +25,7 @@ spec:
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
schedules:
schedules:
- backupMethod: full-backup
enabled: false
cronExpression: "0 18 * * *"
Expand Down
49 changes: 24 additions & 25 deletions addons/etcd/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: etcd-backup-policy-template
labels:
{{- include "etcd.labels" . | nindent 4 }}
clusterdefinition.kubeblocks.io/name: etcd
spec:
backupPolicies:
- componentDefs:
- etcd
target:
role: leader
backupMethods:
- name: {{ include "etcd.backupActionSetName" .}}
snapshotVolumes: false
actionSetName: {{ include "etcd.backupActionSetName" .}}
targetVolumes:
volumes:
- tls
- data
volumeMounts:
- name: tls
mountPath: {{ .Values.tlsMountPath }}
- name: data
mountPath: {{ .Values.dataMountPath }}
schedules:
- backupMethod: {{ include "etcd.backupActionSetName" .}}
enabled: false
cronExpression: "0 18 * * 0"
retentionPeriod: 7d
serviceKind: ETCD
compDefs:
- etcd
target:
role: leader
backupMethods:
- name: {{ include "etcd.backupActionSetName" .}}
snapshotVolumes: false
actionSetName: {{ include "etcd.backupActionSetName" .}}
targetVolumes:
volumes:
- tls
- data
volumeMounts:
- name: tls
mountPath: {{ .Values.tlsMountPath }}
- name: data
mountPath: {{ .Values.dataMountPath }}
schedules:
- backupMethod: {{ include "etcd.backupActionSetName" .}}
enabled: false
cronExpression: "0 18 * * 0"
retentionPeriod: 7d
2 changes: 0 additions & 2 deletions addons/mariadb/templates/actionset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ kind: ActionSet
metadata:
name: mariadb-physical-backup
labels:
clusterdefinition.kubeblocks.io/name: mariadb
dataprotection.kubeblocks.io/is-default-policy-template: "true"
{{- include "mariadb.labels" . | nindent 4 }}
spec:
env:
Expand Down
33 changes: 16 additions & 17 deletions addons/mariadb/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: mariadb-backup-policy-template
labels:
clusterdefinition.kubeblocks.io/name: mariadb
{{- include "mariadb.labels" . | nindent 4 }}
spec:
backupPolicies:
- componentDefs:
- mariadb-{{ .Chart.Version }}
backupMethods:
- name: mariadb-backup
snapshotVolumes: false
actionSetName: mariadb-physical-backup
targetVolumes:
volumeMounts:
- name: data
mountPath: /var/lib/mysql
schedules:
- backupMethod: mariadb-backup
enabled: false
cronExpression: "0 18 * * *"
serviceKind: Mariadb
compDefs:
- mariadb
backupMethods:
- name: mariadb-backup
snapshotVolumes: false
actionSetName: mariadb-physical-backup
targetVolumes:
volumeMounts:
- name: data
mountPath: /var/lib/mysql
schedules:
- backupMethod: mariadb-backup
enabled: false
cronExpression: "0 18 * * *"
31 changes: 15 additions & 16 deletions addons/milvus/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: milvus-{{ .Chart.Version }}
labels:
clusterdefinition.kubeblocks.io/name: milvus-{{ .Chart.Version }}
{{- include "milvus.labels" . | nindent 4 }}
spec:
backupPolicies:
- componentDefs:
- milvus-standalone
backupMethods:
- name: volume-snapshot
snapshotVolumes: true
targetVolumes:
volumes:
- data
schedules:
- backupMethod: volume-snapshot
enabled: false
retentionPeriod: 7d
cronExpression: "0 18 * * 0"
serviceKind: Milvus
compDefs:
- milvus-standalone
backupMethods:
- name: volume-snapshot
snapshotVolumes: true
targetVolumes:
volumes:
- data
schedules:
- backupMethod: volume-snapshot
enabled: false
retentionPeriod: 7d
cronExpression: "0 18 * * 0"
29 changes: 15 additions & 14 deletions addons/mogdb/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: mogdb-backup-policy-template
labels:
{{- include "mogdb.labels" . | nindent 4 }}
spec:
backupPolicies:
- componentDefs: [mogdb-5]
target:
role: secondary
fallbackRole: primary
account: root
backupMethods:
serviceKind: MogDB
compDefs: [mogdb-5]
target:
role: secondary
fallbackRole: primary
account: root
backupMethods:
- name: mogdb-basebackup
actionSetName: mogdb-basebackup
snapshotVolumes: false
envMapping:
- key: IMAGE_TAG
env:
- name: IMAGE_TAG
valueFrom:
componentDef:
- names: [mogdb-5]
mappingValue: "5.0.5"
versionMapping:
- serviceVersions:
- "5"
mappedValue: "5.0.5"
targetVolumes:
volumeMounts:
- name: data
Expand All @@ -35,7 +36,7 @@ spec:
mountPath: {{ .Values.dataMountPath }}
volumes:
- data
schedules:
schedules:
- backupMethod: mogdb-basebackup
enabled: false
cronExpression: "0 18 * * *"
Expand Down
82 changes: 40 additions & 42 deletions addons/mongodb/templates/backuppolicytemplate.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
apiVersion: apps.kubeblocks.io/v1alpha1
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupPolicyTemplate
metadata:
name: mongodb-backup-policy-template
labels:
clusterdefinition.kubeblocks.io/name: mongodb
service-kind/mongodb: "true"
{{- include "mongodb.labels" . | nindent 4 }}
spec:
backupPolicies:
- componentDefs: [mongodb]
target:
role: secondary
fallbackRole: primary
account: root
backupMethods:
- name: dump
snapshotVolumes: false
actionSetName: mongodb-dump
- name: datafile
snapshotVolumes: false
actionSetName: mongodb-physical-backup
targetVolumes:
volumeMounts:
- name: data
mountPath: {{ .Values.dataMountPath }}
- name: volume-snapshot
snapshotVolumes: true
actionSetName: mongodb-volumesnapshot
targetVolumes:
volumes:
- data
volumeMounts:
- name: data
mountPath: {{ .Values.dataMountPath }}
schedules:
- backupMethod: dump
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
- backupMethod: datafile
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
- backupMethod: volume-snapshot
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
serviceKind: MongoDB
compDefs: [mongodb]
target:
role: secondary
fallbackRole: primary
account: root
backupMethods:
- name: dump
snapshotVolumes: false
actionSetName: mongodb-dump
- name: datafile
snapshotVolumes: false
actionSetName: mongodb-physical-backup
targetVolumes:
volumeMounts:
- name: data
mountPath: {{ .Values.dataMountPath }}
- name: volume-snapshot
snapshotVolumes: true
actionSetName: mongodb-volumesnapshot
targetVolumes:
volumes:
- data
volumeMounts:
- name: data
mountPath: {{ .Values.dataMountPath }}
schedules:
- backupMethod: dump
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
- backupMethod: datafile
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
- backupMethod: volume-snapshot
enabled: false
cronExpression: "0 18 * * *"
retentionPeriod: 7d
Loading

0 comments on commit c47979c

Please sign in to comment.