From 811d58834c81dd72cc1f9bc7675ce9ccd648a971 Mon Sep 17 00:00:00 2001 From: danfengl Date: Thu, 18 Apr 2024 09:11:58 +0000 Subject: [PATCH] Remove CSI plugin in E2E test Signed-off-by: danfengl --- test/e2e/e2e_suite_test.go | 12 ----------- test/util/velero/install.go | 4 ++-- test/util/velero/velero_utils.go | 36 +++++++++----------------------- 3 files changed, 12 insertions(+), 40 deletions(-) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 225f8bf6a7..216414b5af 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -220,18 +220,6 @@ func TestE2e(t *testing.T) { t.Skip("Skipping E2E tests") } - if VeleroCfg.CloudProvider != "kind" { - fmt.Println("For cloud platforms, object store plugin provider will be set as cloud provider") - // If ObjectStoreProvider is not provided, then using the value same as CloudProvider - if VeleroCfg.ObjectStoreProvider == "" { - VeleroCfg.ObjectStoreProvider = VeleroCfg.CloudProvider - } - } else { - if VeleroCfg.ObjectStoreProvider == "" { - t.Error(errors.New("No object store provider specified - must be specified when using kind as the cloud provider")) // Must have an object store provider - } - } - var err error if err = GetKubeconfigContext(); err != nil { fmt.Println(err) diff --git a/test/util/velero/install.go b/test/util/velero/install.go index ccbb6420c2..09fc7f3f77 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -387,7 +387,7 @@ func createVelereResources(ctx context.Context, cli, namespace string, args []st return errors.Wrapf(err, "failed to unmarshal the resources: %s", stdout) } - if err = patchResources(ctx, resources, namespace, options); err != nil { + if err = patchResources(resources, namespace, options); err != nil { return errors.Wrapf(err, "failed to patch resources") } @@ -409,7 +409,7 @@ func createVelereResources(ctx context.Context, cli, namespace string, args []st } // patch the velero resources -func patchResources(ctx context.Context, resources *unstructured.UnstructuredList, namespace string, options *installOptions) error { +func patchResources(resources *unstructured.UnstructuredList, namespace string, options *installOptions) error { i := 0 size := 2 var deploy apps.Deployment diff --git a/test/util/velero/velero_utils.go b/test/util/velero/velero_utils.go index 6774a05d87..7727f82faa 100644 --- a/test/util/velero/velero_utils.go +++ b/test/util/velero/velero_utils.go @@ -109,12 +109,11 @@ var pluginsMatrix = map[string]map[string][]string{ "azure": {"velero/velero-plugin-for-microsoft-azure:main"}, "vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"}, "gcp": {"velero/velero-plugin-for-gcp:main"}, - "csi": {"velero/velero-plugin-for-csi:main"}, "datamover": {"velero/velero-plugin-for-aws:main"}, }, } -func getPluginsByVersion(version, cloudProvider, objectStoreProvider, feature string, needDataMoverPlugin bool) ([]string, error) { +func getPluginsByVersion(version, cloudProvider, objectStoreProvider string, needDataMoverPlugin bool) ([]string, error) { var cloudMap map[string][]string arr := strings.Split(version, ".") if len(arr) >= 3 { @@ -126,26 +125,19 @@ func getPluginsByVersion(version, cloudProvider, objectStoreProvider, feature st return nil, errors.Errorf("fail to get plugins by version: main") } } - var pluginsForFeature []string + var plugins []string + var ok bool if slices.Contains(LocalCloudProviders, cloudProvider) { - var pluginsCSI []string - plugins, ok := cloudMap[Aws] + plugins, ok = cloudMap[Aws] if !ok { return nil, errors.Errorf("fail to get plugins by version: %s and provider %s", version, cloudProvider) } - if cloudProvider == VanillaZFS { - pluginsCSI, ok = cloudMap["csi"] - if !ok { - return nil, errors.Errorf("fail to get plugins by version: %s and provider %s", version, cloudProvider) - } + } else { + plugins, ok = cloudMap[cloudProvider] + if !ok { + return nil, errors.Errorf("fail to get plugins by version: %s and provider %s", version, cloudProvider) } - return append(plugins, pluginsCSI...), nil - } - - plugins, ok := cloudMap[cloudProvider] - if !ok { - return nil, errors.Errorf("fail to get plugins by version: %s and provider %s", version, cloudProvider) } if objectStoreProvider != cloudProvider { @@ -156,13 +148,6 @@ func getPluginsByVersion(version, cloudProvider, objectStoreProvider, feature st plugins = append(plugins, pluginsForObjectStoreProvider...) } - if strings.EqualFold(feature, FeatureCSI) { - pluginsForFeature, ok = cloudMap["csi"] - if !ok { - return nil, errors.Errorf("fail to get CSI plugins by version: %s ", version) - } - plugins = append(plugins, pluginsForFeature...) - } if needDataMoverPlugin { pluginsForDatamover, ok := cloudMap["datamover"] if !ok { @@ -647,7 +632,7 @@ func getProviderPlugins(ctx context.Context, veleroCLI string, cloudProvider str return nil, errors.WithMessage(err, "failed to get velero version") } - plugins, err := getPluginsByVersion(version, cloudProvider, cloudProvider, "", false) + plugins, err := getPluginsByVersion(version, cloudProvider, cloudProvider, false) if err != nil { return nil, errors.WithMessagef(err, "Fail to get plugin by provider %s and version %s", cloudProvider, version) } @@ -663,7 +648,6 @@ func getPlugins(ctx context.Context, veleroCfg VeleroConfig) ([]string, error) { cloudProvider := veleroCfg.CloudProvider objectStoreProvider := veleroCfg.ObjectStoreProvider providerPlugins := veleroCfg.Plugins - feature := veleroCfg.Features needDataMoverPlugin := false // Fetch the plugins for the provider before checking for the object store provider below. @@ -691,7 +675,7 @@ func getPlugins(ctx context.Context, veleroCfg VeleroConfig) ([]string, error) { if veleroCfg.SnapshotMoveData && veleroCfg.DataMoverPlugin == "" && !veleroCfg.IsUpgradeTest { needDataMoverPlugin = true } - plugins, err = getPluginsByVersion(version, cloudProvider, objectStoreProvider, feature, needDataMoverPlugin) + plugins, err = getPluginsByVersion(version, cloudProvider, objectStoreProvider, needDataMoverPlugin) if err != nil { return nil, errors.WithMessagef(err, "Fail to get plugin by provider %s and version %s", objectStoreProvider, version) }