Skip to content

Commit

Permalink
Remove CSI plugin in E2E test
Browse files Browse the repository at this point in the history
Signed-off-by: danfengl <[email protected]>
  • Loading branch information
danfengliu committed Apr 22, 2024
1 parent 22b9465 commit 811d588
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 40 deletions.
12 changes: 0 additions & 12 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
36 changes: 10 additions & 26 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,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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand All @@ -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.
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 811d588

Please sign in to comment.