mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-30 11:46:16 +00:00
Modify upgrade and migration cases.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
+4
-4
@@ -78,7 +78,7 @@ These configuration parameters are expected as values to the following command l
|
||||
1. `--standby-cluster-object-store-provider`: Object store provider for standby cluster.
|
||||
1. `--debug-velero-pod-restart`: A switch for debugging velero pod restart.
|
||||
1. `--fail-fast`: A switch for for failing fast on meeting error.
|
||||
1. `--disable-vsphere-plugin`: A switch for not install the Velero vSphere plugin when the provider is set to `vsphere`.
|
||||
1. `--has-vsphere-plugin`: A switch to indicate whether the Velero vSphere plugin is installed for vSphere environment.
|
||||
|
||||
These configurations or parameters are used to generate install options for Velero for each test suite.
|
||||
|
||||
@@ -130,7 +130,7 @@ Below is a mapping between `make` variables to E2E configuration flags.
|
||||
1. `INSTALL_VELERO `: `-install-velero`. Optional.
|
||||
1. `DEBUG_VELERO_POD_RESTART`: `-debug-velero-pod-restart`. Optional.
|
||||
1. `FAIL_FAST`: `--fail-fast`. Optional.
|
||||
1. `DISABLE_VSPHERE_PLUGIN`: `--diable-vsphere-plugin`. Optional.
|
||||
1. `HAS_VSPHERE_PLUGIN`: `--has-vsphere-plugin`. Optional.
|
||||
|
||||
|
||||
|
||||
@@ -338,8 +338,8 @@ BSL_PREFIX=nightly \
|
||||
ADDITIONAL_BSL_PLUGINS=gcr.io/velero-gcp/velero-plugin-for-aws:main \
|
||||
ADDITIONAL_OBJECT_STORE_PROVIDER=aws \
|
||||
ADDITIONAL_BSL_CONFIG=region=us-east-1 \
|
||||
ADDITIONAL_BSL_BUCKET=nightly-normal-account4-test \
|
||||
ADDITIONAL_BSL_PREFIX=addition-bsl \
|
||||
ADDITIONAL_BSL_BUCKET=nightly-restrict-account-test \
|
||||
ADDITIONAL_BSL_PREFIX=nightly \
|
||||
ADDITIONAL_CREDS_FILE=$HOME/aws-credential \
|
||||
VELERO_IMAGE=gcr.io/velero-gcp/velero:main \
|
||||
RESTORE_HELPER_IMAGE=gcr.io/velero-gcp/velero-restore-helper:main \
|
||||
|
||||
@@ -197,9 +197,9 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
|
||||
secretKey,
|
||||
)).To(Succeed())
|
||||
|
||||
bsls := []string{"default", additionalBsl}
|
||||
BSLs := []string{"default", additionalBsl}
|
||||
|
||||
for _, bsl := range bsls {
|
||||
for _, bsl := range BSLs {
|
||||
backupName = fmt.Sprintf("backup-%s", bsl)
|
||||
restoreName = fmt.Sprintf("restore-%s", bsl)
|
||||
// We limit the length of backup name here to avoid the issue of vsphere plugin https://github.com/vmware-tanzu/velero-plugin-for-vsphere/issues/370
|
||||
@@ -209,8 +209,8 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
|
||||
restoreName = fmt.Sprintf("%s-%s", restoreName, UUIDgen)
|
||||
}
|
||||
veleroCfg.ProvideSnapshotsVolumeParam = !provideSnapshotVolumesParmInBackup
|
||||
workloadNmespace := kibishiiNamespace + bsl
|
||||
Expect(RunKibishiiTests(veleroCfg, backupName, restoreName, bsl, workloadNmespace, useVolumeSnapshots, !useVolumeSnapshots)).To(Succeed(),
|
||||
workloadNS := kibishiiNamespace + bsl
|
||||
Expect(RunKibishiiTests(veleroCfg, backupName, restoreName, bsl, workloadNS, useVolumeSnapshots, !useVolumeSnapshots)).To(Succeed(),
|
||||
"Failed to successfully backup and restore Kibishii namespace using BSL %s", bsl)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -41,7 +41,7 @@ const (
|
||||
bslDeletionTestNs = "bsl-deletion"
|
||||
)
|
||||
|
||||
// Test backup and restore of Kibishi using restic
|
||||
// Test backup and restore of Kibishii using restic
|
||||
|
||||
func BslDeletionWithSnapshots() {
|
||||
BslDeletionTest(true)
|
||||
@@ -141,10 +141,10 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
podName1 := "kibishii-deployment-0"
|
||||
podName2 := "kibishii-deployment-1"
|
||||
|
||||
label_1 := "for=1"
|
||||
label1 := "for=1"
|
||||
// TODO remove when issue https://github.com/vmware-tanzu/velero/issues/4724 is fixed
|
||||
//label_2 := "for!=1"
|
||||
label_2 := "for=2"
|
||||
//label2 := "for!=1"
|
||||
label2 := "for=2"
|
||||
By("Create namespace for sample workload", func() {
|
||||
Expect(CreateNamespace(oneHourTimeout, *veleroCfg.ClientToInstallVelero, bslDeletionTestNs)).To(Succeed())
|
||||
})
|
||||
@@ -157,8 +157,8 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
|
||||
// Restic can not backup PV only, so pod need to be labeled also
|
||||
By("Label all 2 worker-pods of Kibishii", func() {
|
||||
Expect(AddLabelToPod(context.Background(), podName1, bslDeletionTestNs, label_1)).To(Succeed())
|
||||
Expect(AddLabelToPod(context.Background(), "kibishii-deployment-1", bslDeletionTestNs, label_2)).To(Succeed())
|
||||
Expect(AddLabelToPod(context.Background(), podName1, bslDeletionTestNs, label1)).To(Succeed())
|
||||
Expect(AddLabelToPod(context.Background(), "kibishii-deployment-1", bslDeletionTestNs, label2)).To(Succeed())
|
||||
})
|
||||
|
||||
By("Get all 2 PVCs of Kibishii and label them separately ", func() {
|
||||
@@ -172,8 +172,8 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
fmt.Println(pvc)
|
||||
Expect(pvc).To(HaveLen(1))
|
||||
pvc2 := pvc[0]
|
||||
Expect(AddLabelToPvc(context.Background(), pvc1, bslDeletionTestNs, label_1)).To(Succeed())
|
||||
Expect(AddLabelToPvc(context.Background(), pvc2, bslDeletionTestNs, label_2)).To(Succeed())
|
||||
Expect(AddLabelToPvc(context.Background(), pvc1, bslDeletionTestNs, label1)).To(Succeed())
|
||||
Expect(AddLabelToPvc(context.Background(), pvc2, bslDeletionTestNs, label2)).To(Succeed())
|
||||
})
|
||||
|
||||
var BackupCfg BackupConfig
|
||||
@@ -182,7 +182,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
BackupCfg.BackupLocation = backupLocation1
|
||||
BackupCfg.UseVolumeSnapshots = useVolumeSnapshots
|
||||
BackupCfg.DefaultVolumesToFsBackup = !useVolumeSnapshots
|
||||
BackupCfg.Selector = label_1
|
||||
BackupCfg.Selector = label1
|
||||
By(fmt.Sprintf("Backup one of PV of sample workload by label-1 - Kibishii by the first BSL %s", backupLocation1), func() {
|
||||
// TODO currently, the upgrade case covers the upgrade path from 1.6 to main and the velero v1.6 doesn't support "debug" command
|
||||
// TODO move to "runDebug" after we bump up to 1.7 in the upgrade case
|
||||
@@ -195,7 +195,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
|
||||
BackupCfg.BackupName = backupName2
|
||||
BackupCfg.BackupLocation = backupLocation2
|
||||
BackupCfg.Selector = label_2
|
||||
BackupCfg.Selector = label2
|
||||
By(fmt.Sprintf("Back up the other one PV of sample workload with label-2 into the additional BSL %s", backupLocation2), func() {
|
||||
Expect(VeleroBackupNamespace(oneHourTimeout, veleroCfg.VeleroCLI,
|
||||
veleroCfg.VeleroNamespace, BackupCfg)).To(Succeed(), func() string {
|
||||
@@ -205,8 +205,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
})
|
||||
|
||||
if useVolumeSnapshots {
|
||||
if veleroCfg.CloudProvider == Vsphere {
|
||||
// TODO - remove after upload progress monitoring is implemented
|
||||
if veleroCfg.HasVspherePlugin {
|
||||
By("Waiting for vSphere uploads to complete", func() {
|
||||
Expect(WaitForVSphereUploadCompletion(oneHourTimeout, time.Hour,
|
||||
bslDeletionTestNs, 2)).To(Succeed())
|
||||
@@ -324,7 +323,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
// })
|
||||
|
||||
if useVolumeSnapshots {
|
||||
if veleroCfg.CloudProvider == Vsphere {
|
||||
if veleroCfg.HasVspherePlugin {
|
||||
By(fmt.Sprintf("Snapshot in backup %s should still exist, because snapshot CR will be deleted 24 hours later if the status is a success", backupName2), func() {
|
||||
Expect(SnapshotCRsCountShouldBe(context.Background(), bslDeletionTestNs,
|
||||
backupName1, 1)).To(Succeed())
|
||||
@@ -332,6 +331,7 @@ func BslDeletionTest(useVolumeSnapshots bool) {
|
||||
backupName2, 1)).To(Succeed())
|
||||
})
|
||||
}
|
||||
|
||||
var snapshotCheckPoint SnapshotCheckPoint
|
||||
snapshotCheckPoint.NamespaceBackedUp = bslDeletionTestNs
|
||||
By(fmt.Sprintf("Snapshot should not be deleted in cloud object store after deleting bsl %s", backupLocation1), func() {
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
"github.com/google/uuid"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"golang.org/x/mod/semver"
|
||||
|
||||
. "github.com/vmware-tanzu/velero/test"
|
||||
util "github.com/vmware-tanzu/velero/test/util/csi"
|
||||
@@ -142,38 +141,12 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version)
|
||||
if veleroCLI2Version.VeleroVersion == "self" {
|
||||
veleroCLI2Version.VeleroCLI = veleroCfg.VeleroCLI
|
||||
} else {
|
||||
fmt.Printf("Using default images address of Velero CLI %s\n", veleroCLI2Version.VeleroVersion)
|
||||
OriginVeleroCfg.VeleroImage = ""
|
||||
OriginVeleroCfg.RestoreHelperImage = ""
|
||||
OriginVeleroCfg.Plugins = ""
|
||||
OriginVeleroCfg, err = SetImagesToDefaultValues(
|
||||
OriginVeleroCfg,
|
||||
veleroCLI2Version.VeleroVersion,
|
||||
)
|
||||
Expect(err).To(Succeed(), "Fail to set images for the migrate-from Velero installation.")
|
||||
|
||||
versionWithoutPatch := semver.MajorMinor(veleroCLI2Version.VeleroVersion)
|
||||
// Read migration case needs plugins from the PluginsMatrix map.
|
||||
migrationNeedPlugins, ok := PluginsMatrix[versionWithoutPatch]
|
||||
Expect(ok).To(BeTrue())
|
||||
|
||||
if OriginVeleroCfg.CloudProvider == Azure {
|
||||
OriginVeleroCfg.Plugins = migrationNeedPlugins[Azure][0]
|
||||
}
|
||||
if OriginVeleroCfg.CloudProvider == AWS {
|
||||
OriginVeleroCfg.Plugins = migrationNeedPlugins[AWS][0]
|
||||
}
|
||||
// If HasVspherePlugin is false, only install the AWS plugin.
|
||||
// If do nothing here, the default behavior is
|
||||
// installing both AWS and vSphere plugins.
|
||||
if OriginVeleroCfg.CloudProvider == Vsphere &&
|
||||
!OriginVeleroCfg.HasVspherePlugin {
|
||||
OriginVeleroCfg.Plugins = migrationNeedPlugins[AWS][0]
|
||||
}
|
||||
// Because Velero CSI plugin is deprecated in v1.14,
|
||||
// only need to install it for version lower than v1.14.
|
||||
if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) &&
|
||||
semver.Compare(versionWithoutPatch, "v1.14") < 0 {
|
||||
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[CSI][0]
|
||||
}
|
||||
if OriginVeleroCfg.SnapshotMoveData && OriginVeleroCfg.CloudProvider == Azure {
|
||||
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[AWS][0]
|
||||
}
|
||||
veleroCLI2Version.VeleroCLI, err = InstallVeleroCLI(veleroCLI2Version.VeleroVersion)
|
||||
Expect(err).To(Succeed())
|
||||
}
|
||||
|
||||
@@ -124,14 +124,16 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, veleroCLI2Version VeleroC
|
||||
veleroCfg.GCFrequency = ""
|
||||
By(fmt.Sprintf("Install the expected old version Velero (%s) for upgrade",
|
||||
veleroCLI2Version.VeleroVersion), func() {
|
||||
//Set VeleroImage and RestoreHelperImage to blank
|
||||
//VeleroImage and RestoreHelperImage should be the default value in originalCli
|
||||
tmpCfgForOldVeleroInstall := veleroCfg
|
||||
tmpCfgForOldVeleroInstall.UpgradeFromVeleroVersion = veleroCLI2Version.VeleroVersion
|
||||
tmpCfgForOldVeleroInstall.VeleroCLI = veleroCLI2Version.VeleroCLI
|
||||
tmpCfgForOldVeleroInstall.VeleroImage = ""
|
||||
tmpCfgForOldVeleroInstall.RestoreHelperImage = ""
|
||||
tmpCfgForOldVeleroInstall.Plugins = ""
|
||||
|
||||
tmpCfgForOldVeleroInstall, err = SetImagesToDefaultValues(
|
||||
tmpCfgForOldVeleroInstall,
|
||||
veleroCLI2Version.VeleroVersion,
|
||||
)
|
||||
Expect(err).To(Succeed(), "Fail to set the images for upgrade-from Velero installation.")
|
||||
|
||||
tmpCfgForOldVeleroInstall.UploaderType = ""
|
||||
version, err := GetVeleroVersion(oneHourTimeout, tmpCfgForOldVeleroInstall.VeleroCLI, true)
|
||||
Expect(err).To(Succeed(), "Fail to get Velero version")
|
||||
@@ -145,9 +147,6 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, veleroCLI2Version VeleroC
|
||||
tmpCfgForOldVeleroInstall.UseRestic = !useVolumeSnapshots
|
||||
tmpCfgForOldVeleroInstall.UseNodeAgent = false
|
||||
}
|
||||
//TODO: Remove this setting when upgrade path is from 1.13 to higher
|
||||
//TODO: version, or self version 1.12 and older versions have no this parameter.
|
||||
tmpCfgForOldVeleroInstall.WithoutDisableInformerCacheParam = true
|
||||
|
||||
Expect(VeleroInstall(context.Background(), &tmpCfgForOldVeleroInstall, false)).To(Succeed())
|
||||
Expect(CheckVeleroVersion(context.Background(), tmpCfgForOldVeleroInstall.VeleroCLI,
|
||||
|
||||
Reference in New Issue
Block a user