Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CSI plugin in E2E test #7710

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"flag"
"fmt"
"slices"
"testing"
"time"

Expand Down Expand Up @@ -220,7 +221,7 @@ func TestE2e(t *testing.T) {
t.Skip("Skipping E2E tests")
}

if VeleroCfg.CloudProvider != "kind" {
if !slices.Contains(LocalCloudProviders, VeleroCfg.CloudProvider) {
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 == "" {
Expand Down
4 changes: 2 additions & 2 deletions test/util/velero/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -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
Expand Down
44 changes: 16 additions & 28 deletions test/util/velero/velero_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -126,43 +125,33 @@ 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)
}

// TODO: Is this section need?
if objectStoreProvider != cloudProvider {
pluginsForObjectStoreProvider, ok := cloudMap[objectStoreProvider]
if !ok {
return nil, errors.Errorf("fail to get plugins by version: %s and object store provider %s", version, objectStoreProvider)
}
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)
for _, p := range pluginsForObjectStoreProvider {
if !slices.Contains(plugins, p) {
plugins = append(plugins, p)
}
}
plugins = append(plugins, pluginsForFeature...)
}

if needDataMoverPlugin {
pluginsForDatamover, ok := cloudMap["datamover"]
if !ok {
Expand Down Expand Up @@ -647,7 +636,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)
}
Expand All @@ -663,7 +652,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.
Expand Down Expand Up @@ -691,7 +679,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)
}
Expand Down
Loading