diff --git a/test/Makefile b/test/Makefile index 1210df871a..276cc76afd 100644 --- a/test/Makefile +++ b/test/Makefile @@ -197,7 +197,7 @@ run-e2e: ginkgo --standby-cluster-name=$(STANDBY_CLUSTER_NAME) \ --eks-policy-arn=$(EKS_POLICY_ARN) \ --default-cls-service-account-name=$(DEFAULT_CLS_SERVICE_ACCOUNT_NAME) \ - --standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME) + --standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME) \ --kibishii-directory=$(KIBISHII_DIRECTORY) \ --disable-informer-cache=$(DISABLE_INFORMER_CACHE) diff --git a/test/e2e/migration/migration.go b/test/e2e/migration/migration.go index 1aa3524da9..a5a8cc1189 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -25,6 +25,7 @@ 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" @@ -146,24 +147,27 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version) OriginVeleroCfg.RestoreHelperImage = "" OriginVeleroCfg.Plugins = "" - // It is for v1.13.x migration scenario only, because since v1.14, nightly CI won't - // pass velero-plugin-for-csi to E2E test anymore, and velero installation will not - // fetch velero-plugin-for-csi automatically, so add it as hardcode below. - // TODO: remove this section from future version like v1.15, e.g. + 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 = "velero/velero-plugin-for-microsoft-azure:v1.9.0" + OriginVeleroCfg.Plugins = migrationNeedPlugins[Azure][0] } if OriginVeleroCfg.CloudProvider == AWS { - OriginVeleroCfg.Plugins = "velero/velero-plugin-for-aws:v1.9.0" + OriginVeleroCfg.Plugins = migrationNeedPlugins[AWS][0] } - if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) { - OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-csi:v0.7.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 { - if OriginVeleroCfg.CloudProvider == Azure { - OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-aws:v1.9.0" - } + if OriginVeleroCfg.SnapshotMoveData && OriginVeleroCfg.CloudProvider == Azure { + OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[AWS][0] } + veleroCLI2Version.VeleroCLI, err = InstallVeleroCLI(veleroCLI2Version.VeleroVersion) Expect(err).To(Succeed()) } diff --git a/test/types.go b/test/types.go index 083fcdbbad..f49a264fe0 100644 --- a/test/types.go +++ b/test/types.go @@ -35,12 +35,13 @@ const Azure = "azure" const AzureCSI = "azure-csi" const AwsCSI = "aws-csi" const AWS = "aws" -const Gcp = "gcp" +const GCP = "gcp" const Vsphere = "vsphere" +const CSI = "csi" const UploaderTypeRestic = "restic" -var PublicCloudProviders = []string{AWS, Azure, Gcp, Vsphere} +var PublicCloudProviders = []string{AWS, Azure, GCP, Vsphere} var LocalCloudProviders = []string{Kind, VanillaZFS} var CloudProviders = append(PublicCloudProviders, LocalCloudProviders...) diff --git a/test/util/providers/common.go b/test/util/providers/common.go index 99441d268e..46e42894ef 100644 --- a/test/util/providers/common.go +++ b/test/util/providers/common.go @@ -78,7 +78,7 @@ func getProvider(cloudProvider string) (ObjectsInStorage, error) { case AWS, Vsphere: aws := AWSStorage("") s = &aws - case Gcp: + case GCP: gcs := GCSStorage("") s = &gcs case Azure: diff --git a/test/util/velero/velero_utils.go b/test/util/velero/velero_utils.go index bedfa25d1c..cec0d61869 100644 --- a/test/util/velero/velero_utils.go +++ b/test/util/velero/velero_utils.go @@ -54,77 +54,56 @@ const BackupObjectsPrefix = "backups" const RestoreObjectsPrefix = "restores" const PluginsObjectsPrefix = "plugins" -var pluginsMatrix = map[string]map[string][]string{ - "v1.7": { - "aws": {"velero/velero-plugin-for-aws:v1.3.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.3.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.3.0"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.3.0"}, - "csi": {"velero/velero-plugin-for-csi:v0.2.0"}, - }, - "v1.8": { - "aws": {"velero/velero-plugin-for-aws:v1.4.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.4.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.3.1"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.4.0"}, - "csi": {"velero/velero-plugin-for-csi:v0.2.0"}, - }, - "v1.9": { - "aws": {"velero/velero-plugin-for-aws:v1.5.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.5.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.4.0"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.5.0"}, - "csi": {"velero/velero-plugin-for-csi:v0.3.0"}, - }, +var PluginsMatrix = map[string]map[string][]string{ "v1.10": { - "aws": {"velero/velero-plugin-for-aws:v1.6.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.6.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.6.0"}, - "csi": {"velero/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"}, }, "v1.11": { - "aws": {"velero/velero-plugin-for-aws:v1.7.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.7.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.7.0"}, - "csi": {"velero/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"}, }, "v1.12": { - "aws": {"velero/velero-plugin-for-aws:v1.8.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.8.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.8.0"}, - "csi": {"velero/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"}, }, "v1.13": { - "aws": {"velero/velero-plugin-for-aws:v1.9.2"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.9.2"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.9.2"}, - "csi": {"velero/velero-plugin-for-csi:v0.7.1"}, - "datamover": {"velero/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"}, }, "v1.14": { - "aws": {"velero/velero-plugin-for-aws:v1.10.1"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.10.1"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.10.1"}, - "datamover": {"velero/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"}, }, "v1.15": { - "aws": {"velero/velero-plugin-for-aws:v1.11.0"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:v1.11.0"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"}, - "gcp": {"velero/velero-plugin-for-gcp:v1.11.0"}, - "datamover": {"velero/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"}, }, "main": { - "aws": {"velero/velero-plugin-for-aws:main"}, - "azure": {"velero/velero-plugin-for-microsoft-azure:main"}, - "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"}, - "gcp": {"velero/velero-plugin-for-gcp:main"}, - "datamover": {"velero/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"}, }, } @@ -132,10 +111,10 @@ func getPluginsByVersion(version, cloudProvider, objectStoreProvider string, nee var cloudMap map[string][]string arr := strings.Split(version, ".") if len(arr) >= 3 { - cloudMap = pluginsMatrix[arr[0]+"."+arr[1]] + cloudMap = PluginsMatrix[arr[0]+"."+arr[1]] } if len(cloudMap) == 0 { - cloudMap = pluginsMatrix["main"] + cloudMap = PluginsMatrix["main"] if len(cloudMap) == 0 { return nil, errors.Errorf("fail to get plugins by version: main") }