Merge branch 'main' into data-mover-ms-new-exposer

This commit is contained in:
Lyndon-Li
2024-07-16 15:54:29 +08:00
83 changed files with 1247 additions and 514 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ func (o *Options) runRepoPrune(f velerocli.Factory, namespace string, logger log
credentials.CredentialGetter{
FromFile: credentialFileStore,
FromSecret: credentialSecretStore,
}, o.RepoType, cli, logger)
}, o.RepoType, logger)
}
// backupRepository
+3
View File
@@ -619,6 +619,7 @@ func describNativeSnapshot(d *Describer, details bool, info *volume.BackupVolume
d.Printf("\t\t\tType:\t%s\n", info.NativeSnapshotInfo.VolumeType)
d.Printf("\t\t\tAvailability Zone:\t%s\n", info.NativeSnapshotInfo.VolumeAZ)
d.Printf("\t\t\tIOPS:\t%s\n", info.NativeSnapshotInfo.IOPS)
d.Printf("\t\t\tResult:\t%s\n", info.Result)
} else {
d.Printf("\t\t%s: specify --details for more information\n", info.PVName)
}
@@ -662,6 +663,7 @@ func describeLocalSnapshot(d *Describer, details bool, info *volume.BackupVolume
d.Printf("\t\t\t\tStorage Snapshot ID: %s\n", info.CSISnapshotInfo.SnapshotHandle)
d.Printf("\t\t\t\tSnapshot Size (bytes): %d\n", info.CSISnapshotInfo.Size)
d.Printf("\t\t\t\tCSI Driver: %s\n", info.CSISnapshotInfo.Driver)
d.Printf("\t\t\t\tResult: %s\n", info.Result)
} else {
d.Printf("\t\t\tSnapshot: %s\n", "included, specify --details for more information")
}
@@ -683,6 +685,7 @@ func describeDataMovement(d *Describer, details bool, info *volume.BackupVolumeI
d.Printf("\t\t\t\tData Mover: %s\n", dataMover)
d.Printf("\t\t\t\tUploader Type: %s\n", info.SnapshotDataMovementInfo.UploaderType)
d.Printf("\t\t\t\tMoved data Size (bytes): %d\n", info.SnapshotDataMovementInfo.Size)
d.Printf("\t\t\t\tResult: %s\n", info.Result)
} else {
d.Printf("\t\t\tData Movement: %s\n", "included, specify --details for more information")
}
+14 -7
View File
@@ -22,17 +22,15 @@ import (
"text/tabwriter"
"time"
"github.com/vmware-tanzu/velero/internal/volume"
"github.com/vmware-tanzu/velero/pkg/itemoperation"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
"github.com/vmware-tanzu/velero/pkg/builder"
"github.com/vmware-tanzu/velero/internal/volume"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
"github.com/vmware-tanzu/velero/pkg/builder"
"github.com/vmware-tanzu/velero/pkg/itemoperation"
)
func TestDescribeUploaderConfig(t *testing.T) {
@@ -353,6 +351,7 @@ func TestDescribeNativeSnapshots(t *testing.T) {
{
BackupMethod: volume.NativeSnapshot,
PVName: "pv-1",
Result: volume.VolumeResultSucceeded,
NativeSnapshotInfo: &volume.NativeSnapshotInfo{
SnapshotHandle: "snapshot-1",
VolumeType: "ebs",
@@ -368,6 +367,7 @@ func TestDescribeNativeSnapshots(t *testing.T) {
Type: ebs
Availability Zone: us-east-2
IOPS: 1000 mbps
Result: succeeded
`,
},
}
@@ -438,6 +438,7 @@ func TestCSISnapshots(t *testing.T) {
PVCNamespace: "pvc-ns-2",
PVCName: "pvc-2",
PreserveLocalSnapshot: true,
Result: volume.VolumeResultSucceeded,
CSISnapshotInfo: &volume.CSISnapshotInfo{
SnapshotHandle: "snapshot-2",
Size: 1024,
@@ -456,6 +457,7 @@ func TestCSISnapshots(t *testing.T) {
Storage Snapshot ID: snapshot-2
Snapshot Size (bytes): 1024
CSI Driver: fake-driver
Result: succeeded
`,
},
{
@@ -487,6 +489,7 @@ func TestCSISnapshots(t *testing.T) {
PVCNamespace: "pvc-ns-4",
PVCName: "pvc-4",
SnapshotDataMoved: true,
Result: volume.VolumeResultSucceeded,
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
DataMover: "velero",
UploaderType: "fake-uploader",
@@ -503,6 +506,7 @@ func TestCSISnapshots(t *testing.T) {
Data Mover: velero
Uploader Type: fake-uploader
Moved data Size (bytes): 0
Result: succeeded
`,
},
{
@@ -512,12 +516,14 @@ func TestCSISnapshots(t *testing.T) {
BackupMethod: volume.CSISnapshot,
PVCNamespace: "pvc-ns-5",
PVCName: "pvc-5",
Result: volume.VolumeResultFailed,
SnapshotDataMoved: true,
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
UploaderType: "fake-uploader",
SnapshotHandle: "fake-repo-id-5",
OperationID: "fake-operation-5",
Size: 100,
Phase: velerov2alpha1.DataUploadPhaseFailed,
},
},
},
@@ -529,6 +535,7 @@ func TestCSISnapshots(t *testing.T) {
Data Mover: velero
Uploader Type: fake-uploader
Moved data Size (bytes): 100
Result: failed
`,
},
}
@@ -371,6 +371,7 @@ func describNativeSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snap
snapshotInfo["type"] = info.NativeSnapshotInfo.VolumeType
snapshotInfo["availabilityZone"] = info.NativeSnapshotInfo.VolumeAZ
snapshotInfo["IOPS"] = info.NativeSnapshotInfo.IOPS
snapshotInfo["result"] = string(info.Result)
snapshotDetails[info.PVName] = snapshotInfo
} else {
@@ -421,6 +422,7 @@ func describeLocalSnapshotInSF(details bool, info *volume.BackupVolumeInfo, snap
localSnapshot["storageSnapshotID"] = info.CSISnapshotInfo.SnapshotHandle
localSnapshot["snapshotSize(bytes)"] = info.CSISnapshotInfo.Size
localSnapshot["csiDriver"] = info.CSISnapshotInfo.Driver
localSnapshot["result"] = string(info.Result)
snapshotDetail["snapshot"] = localSnapshot
} else {
@@ -444,6 +446,7 @@ func describeDataMovementInSF(details bool, info *volume.BackupVolumeInfo, snaps
dataMovement["dataMover"] = dataMover
dataMovement["uploaderType"] = info.SnapshotDataMovementInfo.UploaderType
dataMovement["result"] = string(info.Result)
snapshotDetail["dataMovement"] = dataMovement
} else {
@@ -21,17 +21,14 @@ import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/core/v1"
"github.com/vmware-tanzu/velero/internal/volume"
"github.com/vmware-tanzu/velero/pkg/util/results"
"github.com/stretchr/testify/assert"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/builder"
"github.com/vmware-tanzu/velero/pkg/util/results"
)
func TestDescribeBackupInSF(t *testing.T) {
@@ -314,6 +311,7 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
{
BackupMethod: volume.NativeSnapshot,
PVName: "pv-1",
Result: volume.VolumeResultSucceeded,
NativeSnapshotInfo: &volume.NativeSnapshotInfo{
SnapshotHandle: "snapshot-1",
VolumeType: "ebs",
@@ -330,6 +328,7 @@ func TestDescribeNativeSnapshotsInSF(t *testing.T) {
"type": "ebs",
"availabilityZone": "us-east-2",
"IOPS": "1000 mbps",
"result": "succeeded",
},
},
},
@@ -401,6 +400,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
PVCNamespace: "pvc-ns-2",
PVCName: "pvc-2",
PreserveLocalSnapshot: true,
Result: volume.VolumeResultSucceeded,
CSISnapshotInfo: &volume.CSISnapshotInfo{
SnapshotHandle: "snapshot-2",
Size: 1024,
@@ -420,6 +420,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
"storageSnapshotID": "snapshot-2",
"snapshotSize(bytes)": int64(1024),
"csiDriver": "fake-driver",
"result": "succeeded",
},
},
},
@@ -457,6 +458,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
PVCNamespace: "pvc-ns-4",
PVCName: "pvc-4",
SnapshotDataMoved: true,
Result: volume.VolumeResultSucceeded,
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
DataMover: "velero",
UploaderType: "fake-uploader",
@@ -473,6 +475,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
"operationID": "fake-operation-4",
"dataMover": "velero",
"uploaderType": "fake-uploader",
"result": "succeeded",
},
},
},
@@ -484,6 +487,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
{
BackupMethod: volume.CSISnapshot,
PVCNamespace: "pvc-ns-4",
Result: volume.VolumeResultFailed,
PVCName: "pvc-4",
SnapshotDataMoved: true,
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
@@ -501,6 +505,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
"operationID": "fake-operation-4",
"dataMover": "velero",
"uploaderType": "fake-uploader",
"result": "failed",
},
},
},