Modify upgrade and migration cases.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>pull/8371/head
parent
bcb60ed783
commit
bebea4d278
test
e2e
util
kibishii
velero
|
@ -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,
|
||||
|
|
|
@ -38,6 +38,8 @@ const AWS = "aws"
|
|||
const GCP = "gcp"
|
||||
const Vsphere = "vsphere"
|
||||
const CSI = "csi"
|
||||
const Velero = "velero"
|
||||
const VeleroRestoreHelper = "velero-restore-helper"
|
||||
|
||||
const UploaderTypeRestic = "restic"
|
||||
|
||||
|
|
|
@ -65,8 +65,15 @@ func GetKibishiiPVCNameList(workerCount int) []string {
|
|||
}
|
||||
|
||||
// RunKibishiiTests runs kibishii tests on the provider.
|
||||
func RunKibishiiTests(veleroCfg VeleroConfig, backupName, restoreName, backupLocation, kibishiiNamespace string,
|
||||
useVolumeSnapshots, defaultVolumesToFsBackup bool) error {
|
||||
func RunKibishiiTests(
|
||||
veleroCfg VeleroConfig,
|
||||
backupName string,
|
||||
restoreName string,
|
||||
backupLocation string,
|
||||
kibishiiNamespace string,
|
||||
useVolumeSnapshots bool,
|
||||
defaultVolumesToFsBackup bool,
|
||||
) error {
|
||||
pvCount := len(KibishiiPVCNameList)
|
||||
client := *veleroCfg.ClientToInstallVelero
|
||||
oneHourTimeout, ctxCancel := context.WithTimeout(context.Background(), time.Minute*60)
|
||||
|
|
|
@ -36,6 +36,7 @@ import (
|
|||
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/mod/semver"
|
||||
ver "k8s.io/apimachinery/pkg/util/version"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
kbclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
@ -54,67 +55,126 @@ const BackupObjectsPrefix = "backups"
|
|||
const RestoreObjectsPrefix = "restores"
|
||||
const PluginsObjectsPrefix = "plugins"
|
||||
|
||||
var PluginsMatrix = map[string]map[string][]string{
|
||||
var ImagesMatrix = map[string]map[string][]string{
|
||||
"v1.10": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.6.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.6.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.6.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.4.0"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.6.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.6.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.6.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.4.0"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.10.2"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.10.2"},
|
||||
},
|
||||
"v1.11": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.7.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.7.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.7.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.5.0"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.7.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.7.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.7.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.5.0"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.11.1"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.11.1"},
|
||||
},
|
||||
"v1.12": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.8.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.8.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.8.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.6.0"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.8.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.8.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.8.0"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.6.0"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.12.4"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.12.4"},
|
||||
},
|
||||
"v1.13": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.9.2"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.9.2"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.7.1"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.9.2"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.9.2"},
|
||||
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.7.1"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.13.2"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.13.2"},
|
||||
},
|
||||
"v1.14": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.10.1"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.10.1"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.10.1"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.10.1"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.14.1"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.14.1"},
|
||||
},
|
||||
"v1.15": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.11.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.11.0"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.11.0"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.11.0"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:v1.15.0"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:v1.15.0"},
|
||||
},
|
||||
"main": {
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:main"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:main"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
|
||||
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
|
||||
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:main"},
|
||||
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:main"},
|
||||
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
|
||||
"velero": {"gcr.io/velero-gcp/velero:main"},
|
||||
"velero-restore-helper": {"gcr.io/velero-gcp/velero-restore-helper:main"},
|
||||
},
|
||||
}
|
||||
|
||||
func SetImagesToDefaultValues(config VeleroConfig, version string) (VeleroConfig, error) {
|
||||
fmt.Printf("Get the images for version %s\n", version)
|
||||
|
||||
ret := config
|
||||
|
||||
ret.Plugins = ""
|
||||
|
||||
versionWithoutPatch := semver.MajorMinor(version)
|
||||
// Read migration case needs images from the PluginsMatrix map.
|
||||
images, ok := ImagesMatrix[versionWithoutPatch]
|
||||
if !ok {
|
||||
return config, fmt.Errorf("fail to read the images for version %s from the ImagesMatrix",
|
||||
versionWithoutPatch)
|
||||
}
|
||||
|
||||
ret.VeleroImage = images[Velero][0]
|
||||
ret.RestoreHelperImage = images[VeleroRestoreHelper][0]
|
||||
|
||||
if ret.CloudProvider == Azure {
|
||||
ret.Plugins = images[Azure][0]
|
||||
}
|
||||
if ret.CloudProvider == AWS {
|
||||
ret.Plugins = images[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 ret.CloudProvider == Vsphere &&
|
||||
!ret.HasVspherePlugin {
|
||||
ret.Plugins = images[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(ret.Features, FeatureCSI) &&
|
||||
semver.Compare(versionWithoutPatch, "v1.14") < 0 {
|
||||
ret.Plugins = ret.Plugins + "," + images[CSI][0]
|
||||
}
|
||||
if ret.SnapshotMoveData && ret.CloudProvider == Azure {
|
||||
ret.Plugins = ret.Plugins + "," + images[AWS][0]
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func getPluginsByVersion(version string, cloudProvider string, needDataMoverPlugin bool) ([]string, error) {
|
||||
var cloudMap map[string][]string
|
||||
arr := strings.Split(version, ".")
|
||||
if len(arr) >= 3 {
|
||||
cloudMap = PluginsMatrix[arr[0]+"."+arr[1]]
|
||||
cloudMap = ImagesMatrix[arr[0]+"."+arr[1]]
|
||||
}
|
||||
if len(cloudMap) == 0 {
|
||||
cloudMap = PluginsMatrix["main"]
|
||||
cloudMap = ImagesMatrix["main"]
|
||||
if len(cloudMap) == 0 {
|
||||
return nil, errors.Errorf("fail to get plugins by version: main")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue