mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 03:24:39 +00:00
Merge branch 'main' into report-incremental-fallback
This commit is contained in:
@@ -5666,7 +5666,7 @@ func TestUpdateVolumeInfos(t *testing.T) {
|
||||
PVCName: "pvc-1",
|
||||
PVCNamespace: "ns-1",
|
||||
CompletionTimestamp: &metav1.Time{},
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
},
|
||||
},
|
||||
@@ -5677,7 +5677,7 @@ func TestUpdateVolumeInfos(t *testing.T) {
|
||||
PVCNamespace: "ns-1",
|
||||
CompletionTimestamp: &now,
|
||||
Result: volume.VolumeResultFailed,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
RetainedSnapshot: "vs-1",
|
||||
SnapshotHandle: "snapshot-id",
|
||||
@@ -5706,7 +5706,7 @@ func TestUpdateVolumeInfos(t *testing.T) {
|
||||
PVCName: "pvc-1",
|
||||
PVCNamespace: "ns-1",
|
||||
CompletionTimestamp: &metav1.Time{},
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
},
|
||||
},
|
||||
@@ -5717,7 +5717,7 @@ func TestUpdateVolumeInfos(t *testing.T) {
|
||||
PVCNamespace: "ns-1",
|
||||
CompletionTimestamp: &now,
|
||||
Result: volume.VolumeResultSucceeded,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
RetainedSnapshot: "vs-1",
|
||||
SnapshotHandle: "snapshot-id",
|
||||
|
||||
@@ -61,6 +61,12 @@ func (d *DataDownloadBuilder) Phase(phase velerov2alpha1api.DataDownloadPhase) *
|
||||
return d
|
||||
}
|
||||
|
||||
// RestoreType sets the DataDownload's RestoreType.
|
||||
func (d *DataDownloadBuilder) RestoreType(restoreType string) *DataDownloadBuilder {
|
||||
d.object.Spec.RestoreType = restoreType
|
||||
return d
|
||||
}
|
||||
|
||||
// SnapshotID sets the DataDownload's SnapshotID.
|
||||
func (d *DataDownloadBuilder) SnapshotID(id string) *DataDownloadBuilder {
|
||||
d.object.Spec.SnapshotID = id
|
||||
|
||||
@@ -249,6 +249,10 @@ func DescribeBackupSpec(d *Describer, spec velerov1api.BackupSpec) {
|
||||
}
|
||||
d.Printf("Data Mover:\t%s\n", s)
|
||||
|
||||
if string(spec.BackupType) != "" {
|
||||
d.Printf("Backup Type:\t%s\n", spec.BackupType)
|
||||
}
|
||||
|
||||
d.Println()
|
||||
d.Printf("TTL:\t%s\n", spec.TTL.Duration)
|
||||
|
||||
@@ -746,6 +750,10 @@ func describeDataMovement(d *Describer, details bool, info *volume.BackupVolumeI
|
||||
if info.SnapshotDataMovementInfo.IncrementalSize != nil {
|
||||
d.Printf("\t\t\t\tIncremental data Size (bytes): %d\n", *info.SnapshotDataMovementInfo.IncrementalSize)
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.ParentSnapshot != "" {
|
||||
d.Printf("\t\t\t\tParent Snapshot: %s\n", info.SnapshotDataMovementInfo.ParentSnapshot)
|
||||
}
|
||||
|
||||
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")
|
||||
|
||||
@@ -108,6 +108,7 @@ func TestDescribeBackupSpec(t *testing.T) {
|
||||
TTL(72 * time.Hour).
|
||||
CSISnapshotTimeout(10 * time.Minute).
|
||||
DataMover("mover").
|
||||
BackupType(velerov1api.BackupTypeFull).
|
||||
Hooks(velerov1api.BackupHooks{
|
||||
Resources: []velerov1api.BackupResourceHookSpec{
|
||||
{
|
||||
@@ -156,6 +157,7 @@ Storage Location: backup-location
|
||||
Velero-Native Snapshot PVs: auto
|
||||
Snapshot Move Data: auto
|
||||
Data Mover: mover
|
||||
Backup Type: Full
|
||||
|
||||
TTL: 72h0m0s
|
||||
|
||||
@@ -575,7 +577,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
PVCNamespace: "pvc-ns-3",
|
||||
PVCName: "pvc-3",
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-3",
|
||||
@@ -597,7 +599,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
Result: volume.VolumeResultSucceeded,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-4",
|
||||
@@ -625,13 +627,15 @@ func TestCSISnapshots(t *testing.T) {
|
||||
PVCName: "pvc-5",
|
||||
Result: volume.VolumeResultFailed,
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
BackupType: velerov1api.BackupTypeIncremental,
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-5",
|
||||
OperationID: "fake-operation-5",
|
||||
Size: 100,
|
||||
IncrementalSize: ptr.To(int64(50)),
|
||||
Phase: velerov2alpha1.DataUploadPhaseFailed,
|
||||
ParentSnapshot: "fake-parent-snapshot",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -644,6 +648,7 @@ func TestCSISnapshots(t *testing.T) {
|
||||
Uploader Type: fake-uploader
|
||||
Moved data Size (bytes): 100
|
||||
Incremental data Size (bytes): 50
|
||||
Parent Snapshot: fake-parent-snapshot
|
||||
Result: failed
|
||||
`,
|
||||
},
|
||||
|
||||
@@ -136,6 +136,9 @@ func DescribeBackupSpecInSF(d *StructuredDescriber, spec velerov1api.BackupSpec)
|
||||
s = spec.DataMover
|
||||
}
|
||||
backupSpecInfo["dataMover"] = s
|
||||
if string(spec.BackupType) != "" {
|
||||
backupSpecInfo["backupType"] = spec.BackupType
|
||||
}
|
||||
|
||||
// describe TTL
|
||||
backupSpecInfo["TTL"] = spec.TTL.Duration.String()
|
||||
@@ -475,6 +478,9 @@ func describeDataMovementInSF(details bool, info *volume.BackupVolumeInfo, snaps
|
||||
if info.SnapshotDataMovementInfo.IncrementalSize != nil {
|
||||
dataMovement["incrementalSize"] = *info.SnapshotDataMovementInfo.IncrementalSize
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.ParentSnapshot != "" {
|
||||
dataMovement["parentSnapshot"] = info.SnapshotDataMovementInfo.ParentSnapshot
|
||||
}
|
||||
|
||||
snapshotDetail["dataMovement"] = dataMovement
|
||||
} else {
|
||||
|
||||
@@ -24,9 +24,11 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
corev1api "k8s.io/api/core/v1"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"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/util/results"
|
||||
)
|
||||
@@ -45,6 +47,7 @@ func TestDescribeBackupInSF(t *testing.T) {
|
||||
TTL(72 * time.Hour).
|
||||
CSISnapshotTimeout(10 * time.Minute).
|
||||
DataMover("mover").
|
||||
BackupType(velerov1api.BackupTypeFull).
|
||||
Hooks(velerov1api.BackupHooks{
|
||||
Resources: []velerov1api.BackupResourceHookSpec{
|
||||
{
|
||||
@@ -87,6 +90,7 @@ func TestDescribeBackupInSF(t *testing.T) {
|
||||
"clusterScoped": "auto",
|
||||
},
|
||||
"dataMover": "mover",
|
||||
"backupType": velerov1api.BackupTypeFull,
|
||||
"labelSelector": emptyDisplay,
|
||||
"storageLocation": "backup-location",
|
||||
"veleroNativeSnapshotPVs": "auto",
|
||||
@@ -517,7 +521,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
PVCNamespace: "pvc-ns-3",
|
||||
PVCName: "pvc-3",
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-3",
|
||||
@@ -542,7 +546,7 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
Result: volume.VolumeResultSucceeded,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-4",
|
||||
@@ -573,10 +577,15 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
Result: volume.VolumeResultFailed,
|
||||
PVCName: "pvc-4",
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-4",
|
||||
OperationID: "fake-operation-4",
|
||||
BackupType: velerov1api.BackupTypeIncremental,
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
UploaderType: "fake-uploader",
|
||||
SnapshotHandle: "fake-repo-id-4",
|
||||
OperationID: "fake-operation-4",
|
||||
Size: 100,
|
||||
IncrementalSize: ptr.To(int64(50)),
|
||||
Phase: velerov2alpha1.DataUploadPhaseFailed,
|
||||
ParentSnapshot: "fake-parent-snapshot",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -585,10 +594,13 @@ func TestDescribeCSISnapshotsInSF(t *testing.T) {
|
||||
"csiSnapshots": map[string]any{
|
||||
"pvc-ns-4/pvc-4": map[string]any{
|
||||
"dataMovement": map[string]any{
|
||||
"operationID": "fake-operation-4",
|
||||
"dataMover": "velero",
|
||||
"uploaderType": "fake-uploader",
|
||||
"result": "failed",
|
||||
"operationID": "fake-operation-4",
|
||||
"dataMover": "velero",
|
||||
"uploaderType": "fake-uploader",
|
||||
"size": int64(100),
|
||||
"incrementalSize": int64(50),
|
||||
"result": "failed",
|
||||
"parentSnapshot": "fake-parent-snapshot",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -209,6 +209,11 @@ func DescribeRestore(
|
||||
s = string(restore.Spec.ExistingResourcePolicy)
|
||||
}
|
||||
d.Printf("Existing Resource Policy: \t%s\n", s)
|
||||
s = emptyDisplay
|
||||
if restore.Spec.ExistingVolumeDataPolicy != "" {
|
||||
s = string(restore.Spec.ExistingVolumeDataPolicy)
|
||||
}
|
||||
d.Printf("Existing Volume Data Policy: \t%s\n", s)
|
||||
d.Printf("ItemOperationTimeout:\t%s\n", restore.Spec.ItemOperationTimeout.Duration)
|
||||
|
||||
d.Println()
|
||||
@@ -468,6 +473,15 @@ func describeCSISnapshotsRestores(d *Describer, restoreVolInfo []volume.RestoreV
|
||||
d.Printf("\t\t\tOperation ID: %s\n", info.SnapshotDataMovementInfo.OperationID)
|
||||
d.Printf("\t\t\tData Mover: %s\n", info.SnapshotDataMovementInfo.DataMover)
|
||||
d.Printf("\t\t\tUploader Type: %s\n", info.SnapshotDataMovementInfo.UploaderType)
|
||||
if info.SnapshotDataMovementInfo.RestoreType != "" {
|
||||
d.Printf("\t\t\tRestore Type: %s\n", info.SnapshotDataMovementInfo.RestoreType)
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.Size > 0 {
|
||||
d.Printf("\t\t\tRestored data Size (bytes): %d\n", info.SnapshotDataMovementInfo.Size)
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.IncrementalSize != nil {
|
||||
d.Printf("\t\t\tIncremental data Size (bytes): %d\n", *info.SnapshotDataMovementInfo.IncrementalSize)
|
||||
}
|
||||
} else {
|
||||
d.Printf("\t\tData Movement: specify --details for more information\n")
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package output
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"text/tabwriter"
|
||||
@@ -10,11 +11,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
corev1api "k8s.io/api/core/v1"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"github.com/vmware-tanzu/velero/internal/volume"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
"github.com/vmware-tanzu/velero/pkg/builder"
|
||||
"github.com/vmware-tanzu/velero/pkg/itemoperation"
|
||||
velerotest "github.com/vmware-tanzu/velero/pkg/test"
|
||||
"github.com/vmware-tanzu/velero/pkg/util/boolptr"
|
||||
"github.com/vmware-tanzu/velero/pkg/util/results"
|
||||
)
|
||||
@@ -309,11 +312,13 @@ CSI Snapshot Restores:
|
||||
PVName: "pv-3",
|
||||
RestoreMethod: volume.CSISnapshot,
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
Size: 1234,
|
||||
SnapshotDataMovementInfo: &volume.RestoreSnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
Size: 1234,
|
||||
IncrementalSize: ptr.To(int64(500)),
|
||||
RestoreType: "Incremental",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -325,6 +330,9 @@ CSI Snapshot Restores:
|
||||
Operation ID: op-3
|
||||
Data Mover: velero
|
||||
Uploader Type: kopia
|
||||
Restore Type: Incremental
|
||||
Restored data Size (bytes): 1234
|
||||
Incremental data Size (bytes): 500
|
||||
`,
|
||||
},
|
||||
{
|
||||
@@ -336,7 +344,7 @@ CSI Snapshot Restores:
|
||||
PVName: "pv-3",
|
||||
RestoreMethod: volume.CSISnapshot,
|
||||
SnapshotDataMoved: true,
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.RestoreSnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
@@ -415,3 +423,16 @@ func TestDescribeResourceModifier(t *testing.T) {
|
||||
fmt.Println(d.buf.String())
|
||||
require.Equal(t, expectOutput, d.buf.String())
|
||||
}
|
||||
|
||||
func TestDescribeRestore(t *testing.T) {
|
||||
kbClient := velerotest.NewFakeControllerRuntimeClient(t)
|
||||
restore := builder.ForRestore("velero", "test-restore").
|
||||
Backup("test-backup").
|
||||
ExistingResourcePolicy(string(velerov1api.ResourcePolicyTypeUpdate)).
|
||||
ExistingVolumeDataPolicy(string(velerov1api.VolumeDataPolicyTypeFull)).
|
||||
Result()
|
||||
|
||||
out := DescribeRestore(context.Background(), kbClient, restore, nil, false, false, "")
|
||||
assert.Contains(t, out, "Existing Resource Policy: update")
|
||||
assert.Contains(t, out, "Existing Volume Data Policy: full")
|
||||
}
|
||||
|
||||
@@ -196,6 +196,13 @@ func describeRestoreSpecInSF(d *StructuredDescriber, spec velerov1api.RestoreSpe
|
||||
specInfo["existingResourcePolicy"] = emptyDisplay
|
||||
}
|
||||
|
||||
// existing volume data policy
|
||||
if spec.ExistingVolumeDataPolicy != "" {
|
||||
specInfo["existingVolumeDataPolicy"] = string(spec.ExistingVolumeDataPolicy)
|
||||
} else {
|
||||
specInfo["existingVolumeDataPolicy"] = emptyDisplay
|
||||
}
|
||||
|
||||
specInfo["itemOperationTimeout"] = spec.ItemOperationTimeout.Duration.String()
|
||||
specInfo["preserveNodePorts"] = BoolPointerString(spec.PreserveNodePorts, "false", "true", "auto")
|
||||
|
||||
@@ -360,12 +367,22 @@ func describeCSISnapshotsRestoresInSF(d *StructuredDescriber, restoreVolInfo []v
|
||||
}
|
||||
continue
|
||||
}
|
||||
dmInfo := map[string]any{
|
||||
"operationID": info.SnapshotDataMovementInfo.OperationID,
|
||||
"dataMover": info.SnapshotDataMovementInfo.DataMover,
|
||||
"uploaderType": info.SnapshotDataMovementInfo.UploaderType,
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.RestoreType != "" {
|
||||
dmInfo["restoreType"] = info.SnapshotDataMovementInfo.RestoreType
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.Size > 0 {
|
||||
dmInfo["size"] = info.SnapshotDataMovementInfo.Size
|
||||
}
|
||||
if info.SnapshotDataMovementInfo.IncrementalSize != nil {
|
||||
dmInfo["incrementalSize"] = *info.SnapshotDataMovementInfo.IncrementalSize
|
||||
}
|
||||
csiRestores[key] = map[string]any{
|
||||
"dataMovement": map[string]any{
|
||||
"operationID": info.SnapshotDataMovementInfo.OperationID,
|
||||
"dataMover": info.SnapshotDataMovementInfo.DataMover,
|
||||
"uploaderType": info.SnapshotDataMovementInfo.UploaderType,
|
||||
},
|
||||
"dataMovement": dmInfo,
|
||||
}
|
||||
} else {
|
||||
csiRestores[key] = map[string]any{
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
corev1api "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/utils/ptr"
|
||||
|
||||
"github.com/vmware-tanzu/velero/internal/volume"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
@@ -156,25 +157,27 @@ func TestDescribeRestoreSpecInSF(t *testing.T) {
|
||||
"excluded": emptyDisplay,
|
||||
"clusterScoped": "auto",
|
||||
},
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"existingVolumeDataPolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "included namespaces wildcard treated as all",
|
||||
spec: velerov1api.RestoreSpec{
|
||||
BackupName: "backup-2",
|
||||
IncludedNamespaces: []string{"*"},
|
||||
ExcludedNamespaces: []string{"kube-system"},
|
||||
IncludedResources: []string{"pods", "configmaps"},
|
||||
ExcludedResources: []string{"secrets"},
|
||||
ExistingResourcePolicy: velerov1api.ResourcePolicyTypeUpdate,
|
||||
BackupName: "backup-2",
|
||||
IncludedNamespaces: []string{"*"},
|
||||
ExcludedNamespaces: []string{"kube-system"},
|
||||
IncludedResources: []string{"pods", "configmaps"},
|
||||
ExcludedResources: []string{"secrets"},
|
||||
ExistingResourcePolicy: velerov1api.ResourcePolicyTypeUpdate,
|
||||
ExistingVolumeDataPolicy: velerov1api.VolumeDataPolicyTypeFull,
|
||||
},
|
||||
expect: map[string]any{
|
||||
"spec": map[string]any{
|
||||
@@ -188,13 +191,14 @@ func TestDescribeRestoreSpecInSF(t *testing.T) {
|
||||
"excluded": "secrets",
|
||||
"clusterScoped": "auto",
|
||||
},
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": string(velerov1api.ResourcePolicyTypeUpdate),
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": string(velerov1api.ResourcePolicyTypeUpdate),
|
||||
"existingVolumeDataPolicy": string(velerov1api.VolumeDataPolicyTypeFull),
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -223,13 +227,14 @@ func TestDescribeRestoreSpecInSF(t *testing.T) {
|
||||
"excluded": emptyDisplay,
|
||||
"clusterScoped": "auto",
|
||||
},
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
"namespaceMappings": emptyDisplay,
|
||||
"labelSelector": emptyDisplay,
|
||||
"orLabelSelectors": emptyDisplay,
|
||||
"restorePVs": "auto",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"existingVolumeDataPolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "auto",
|
||||
"resourceModifier": map[string]any{
|
||||
"type": "ConfigMap",
|
||||
"name": "my-modifier",
|
||||
@@ -272,13 +277,14 @@ func TestDescribeRestoreSpecInSF(t *testing.T) {
|
||||
"excluded": emptyDisplay,
|
||||
"clusterScoped": "included",
|
||||
},
|
||||
"namespaceMappings": map[string]string{"ns-a": "ns-a-new"},
|
||||
"labelSelector": "app=nginx",
|
||||
"orLabelSelectors": "env=prod or env=stage",
|
||||
"restorePVs": "true",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "false",
|
||||
"namespaceMappings": map[string]string{"ns-a": "ns-a-new"},
|
||||
"labelSelector": "app=nginx",
|
||||
"orLabelSelectors": "env=prod or env=stage",
|
||||
"restorePVs": "true",
|
||||
"existingResourcePolicy": emptyDisplay,
|
||||
"existingVolumeDataPolicy": emptyDisplay,
|
||||
"itemOperationTimeout": "0s",
|
||||
"preserveNodePorts": "false",
|
||||
"resourcePolicy": map[string]any{
|
||||
"type": "configmap",
|
||||
"name": "volume-policy",
|
||||
@@ -467,10 +473,13 @@ func TestDescribeRestoreCSISnapshotsInSF_NoData(t *testing.T) {
|
||||
SnapshotDataMoved: true,
|
||||
PVCName: "pvc-3",
|
||||
PVCNamespace: "ns-3",
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
SnapshotDataMovementInfo: &volume.RestoreSnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
Size: 1234,
|
||||
IncrementalSize: ptr.To(int64(500)),
|
||||
RestoreType: "Incremental",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -479,9 +488,12 @@ func TestDescribeRestoreCSISnapshotsInSF_NoData(t *testing.T) {
|
||||
"csiSnapshotRestores": map[string]any{
|
||||
"ns-3/pvc-3": map[string]any{
|
||||
"dataMovement": map[string]any{
|
||||
"operationID": "op-3",
|
||||
"dataMover": "velero",
|
||||
"uploaderType": "kopia",
|
||||
"operationID": "op-3",
|
||||
"dataMover": "velero",
|
||||
"uploaderType": "kopia",
|
||||
"size": int64(1234),
|
||||
"incrementalSize": int64(500),
|
||||
"restoreType": "Incremental",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -495,7 +507,7 @@ func TestDescribeRestoreCSISnapshotsInSF_NoData(t *testing.T) {
|
||||
SnapshotDataMoved: true,
|
||||
PVCName: "pvc-3",
|
||||
PVCNamespace: "ns-3",
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.RestoreSnapshotDataMovementInfo{
|
||||
OperationID: "op-3",
|
||||
DataMover: "velero",
|
||||
UploaderType: "kopia",
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
|
||||
"pv-1": {
|
||||
BackupMethod: volume.PodVolumeBackup,
|
||||
PVName: "pv-1",
|
||||
PVBInfo: &volume.PodVolumeInfo{
|
||||
PVBInfo: &volume.PodVolumeBackupInfo{
|
||||
SnapshotHandle: "testSnapshotHandle",
|
||||
Size: 100,
|
||||
NodeName: "testNode",
|
||||
@@ -173,7 +173,7 @@ func TestRestorePVWithVolumeInfo(t *testing.T) {
|
||||
CSISnapshotInfo: &volume.CSISnapshotInfo{
|
||||
Driver: "pd.csi.storage.gke.io",
|
||||
},
|
||||
SnapshotDataMovementInfo: &volume.SnapshotDataMovementInfo{
|
||||
SnapshotDataMovementInfo: &volume.BackupSnapshotDataMovementInfo{
|
||||
DataMover: "velero",
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user