From 525ab02f6b744aa6c008de37890ceff4e9f956b2 Mon Sep 17 00:00:00 2001 From: BornChanger Date: Sun, 16 Jul 2023 00:01:19 +0800 Subject: [PATCH] *: adjust federation restore cr Signed-off-by: BornChanger --- docs/api-references/federation-docs.md | 33 +++++++++++++++++++ ...federation.pingcap.com_volumerestores.yaml | 8 +++++ ...federation.pingcap.com_volumerestores.yaml | 8 +++++ manifests/federation-crd.yaml | 8 +++++ manifests/federation-crd_v1beta1.yaml | 8 +++++ .../pingcap/v1alpha1/openapi_generated.go | 21 ++++++++++++ pkg/apis/federation/pingcap/v1alpha1/types.go | 6 ++++ .../restore/restore_manager.go | 3 ++ 8 files changed, 95 insertions(+) diff --git a/docs/api-references/federation-docs.md b/docs/api-references/federation-docs.md index bed43c216a..be8773c46b 100644 --- a/docs/api-references/federation-docs.md +++ b/docs/api-references/federation-docs.md @@ -1301,6 +1301,39 @@ string +volumeType
+ +string + + + +

VolumeType is type of the restored volume

+ + + + +volumeIOPS
+ +int64 + + + +

VolumeIOPS is IOPS of the restored volume

+ + + + +volumeThroughput
+ +int64 + + + +

VolumeThroughput is bandwidth of the restored volume

+ + + + backup
diff --git a/manifests/crd/federation/v1/federation.pingcap.com_volumerestores.yaml b/manifests/crd/federation/v1/federation.pingcap.com_volumerestores.yaml index 81cb1968e8..8dd8467aab 100644 --- a/manifests/crd/federation/v1/federation.pingcap.com_volumerestores.yaml +++ b/manifests/crd/federation/v1/federation.pingcap.com_volumerestores.yaml @@ -819,6 +819,14 @@ spec: type: string tcNamespace: type: string + volumeIOPS: + format: int64 + type: integer + volumeThroughput: + format: int64 + type: integer + volumeType: + type: string type: object type: array template: diff --git a/manifests/crd/federation/v1beta1/federation.pingcap.com_volumerestores.yaml b/manifests/crd/federation/v1beta1/federation.pingcap.com_volumerestores.yaml index 1619297da0..c14c321839 100644 --- a/manifests/crd/federation/v1beta1/federation.pingcap.com_volumerestores.yaml +++ b/manifests/crd/federation/v1beta1/federation.pingcap.com_volumerestores.yaml @@ -819,6 +819,14 @@ spec: type: string tcNamespace: type: string + volumeIOPS: + format: int64 + type: integer + volumeThroughput: + format: int64 + type: integer + volumeType: + type: string type: object type: array template: diff --git a/manifests/federation-crd.yaml b/manifests/federation-crd.yaml index f246b5c80c..b2da7eb006 100644 --- a/manifests/federation-crd.yaml +++ b/manifests/federation-crd.yaml @@ -2849,6 +2849,14 @@ spec: type: string tcNamespace: type: string + volumeIOPS: + format: int64 + type: integer + volumeThroughput: + format: int64 + type: integer + volumeType: + type: string type: object type: array template: diff --git a/manifests/federation-crd_v1beta1.yaml b/manifests/federation-crd_v1beta1.yaml index f646fe7ed4..255348bf65 100644 --- a/manifests/federation-crd_v1beta1.yaml +++ b/manifests/federation-crd_v1beta1.yaml @@ -2853,6 +2853,14 @@ spec: type: string tcNamespace: type: string + volumeIOPS: + format: int64 + type: integer + volumeThroughput: + format: int64 + type: integer + volumeType: + type: string type: object type: array template: diff --git a/pkg/apis/federation/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/federation/pingcap/v1alpha1/openapi_generated.go index 5d06a89a25..c0978418ad 100644 --- a/pkg/apis/federation/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/federation/pingcap/v1alpha1/openapi_generated.go @@ -619,6 +619,27 @@ func schema_apis_federation_pingcap_v1alpha1_VolumeRestoreMemberCluster(ref comm Format: "", }, }, + "volumeType": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeType is type of the restored volume", + Type: []string{"string"}, + Format: "", + }, + }, + "volumeIOPS": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeIOPS is IOPS of the restored volume", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "volumeThroughput": { + SchemaProps: spec.SchemaProps{ + Description: "VolumeThroughput is bandwidth of the restored volume", + Type: []string{"integer"}, + Format: "int64", + }, + }, "backup": { SchemaProps: spec.SchemaProps{ Description: "Backup is the volume backup information", diff --git a/pkg/apis/federation/pingcap/v1alpha1/types.go b/pkg/apis/federation/pingcap/v1alpha1/types.go index 35995880f6..243f55284e 100644 --- a/pkg/apis/federation/pingcap/v1alpha1/types.go +++ b/pkg/apis/federation/pingcap/v1alpha1/types.go @@ -315,6 +315,12 @@ type VolumeRestoreMemberCluster struct { TCNamespace string `json:"tcNamespace,omitempty"` // AZName is the available zone which the volume snapshots restore to AZName string `json:"azName,omitempty"` + // VolumeType is type of the restored volume + VolumeType string `json:"volumeType,omitempty"` + // VolumeIOPS is IOPS of the restored volume + VolumeIOPS int64 `json:"volumeIOPS,omitempty"` + // VolumeThroughput is bandwidth of the restored volume + VolumeThroughput int64 `json:"volumeThroughput,omitempty"` // Backup is the volume backup information Backup VolumeRestoreMemberBackupInfo `json:"backup,omitempty"` } diff --git a/pkg/fedvolumebackup/restore/restore_manager.go b/pkg/fedvolumebackup/restore/restore_manager.go index b4aab30d2a..7048091d7b 100644 --- a/pkg/fedvolumebackup/restore/restore_manager.go +++ b/pkg/fedvolumebackup/restore/restore_manager.go @@ -491,6 +491,9 @@ func (rm *restoreManager) buildRestoreMember(volumeRestoreName string, memberClu ResourceRequirements: *template.ResourceRequirements.DeepCopy(), Env: template.Env, VolumeAZ: memberCluster.AZName, + VolumeType: memberCluster.VolumeType, + VolumeIOPS: memberCluster.VolumeIOPS, + VolumeThroughput: memberCluster.VolumeThroughput, BR: template.BR.ToBRMemberConfig(memberCluster.TCName, memberCluster.TCNamespace), Tolerations: template.Tolerations, ToolImage: template.ToolImage,