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

OADP-5079 Add support for legacy aws plugin #1565

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

sseago
Copy link
Contributor

@sseago sseago commented Oct 17, 2024

Why the changes were made

Certain s3 providers don't support the AWS SDK v2 updates made in velero-plugin-for-aws v1.9+ (OADP 1.4+). This PR provides the ability to use the v1.8 plugin in a newer OADP environment.

How to test the changes made

In the DPA DefaultPlugins section, use legacy-aws instead of aws. S3 providers that work with the regular aws plugin should still work here. S3 providers that error out in various ways with the regular plugin should also work.

@sseago sseago marked this pull request as draft October 17, 2024 20:34
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2024
@sseago
Copy link
Contributor Author

sseago commented Oct 17, 2024

PR is in Draft state now because this won't work until we have quay builds for the legacy plugin

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2024
@@ -75,6 +76,7 @@ const (
// Plugin names
Copy link
Contributor

@mateusoliveira43 mateusoliveira43 Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing for me. Plugin names are aws, gcp, etc, for me. This is only used as the container name of each plugin, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container name is the only actual "name" string that's used in the velero side of the configuration -- as the container name. aws/gcp/etc. only exist as values for the velero default plugin list. So from a velero point of view, this is the plugin name.

@@ -25,6 +25,7 @@ type DefaultPluginFields struct {
PluginImage string
PluginSecretKey string
PluginName string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would change this to ContainerName to avoid confusion

@@ -398,9 +399,9 @@ func (r *DPAReconciler) validateGCPBackupStorageLocation(bslSpec velerov1.Backup
return nil
}

func pluginExistsInVeleroCR(configuredPlugins []oadpv1alpha1.DefaultPlugin, expectedPlugin oadpv1alpha1.DefaultPlugin) bool {
func pluginExistsInVeleroCR(configuredPlugins []oadpv1alpha1.DefaultPlugin, expectedProvider string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplication of the function changed in controllers/vsl.go. I would delete function in that file and use this one

This function name is wrong, no? From what I see in code, DPA was called velero at some point in time. It should be pluginExistsInDPA or something like this, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid making major functionality changes since we want to backport to 1.4. The only change here is we're passing a regular string rather than a string that's typecast to expectedPlugin -- until this change, the plugin name and the provider were always the same. Now they're not, since both legacy-aws and aws have the provider aws.

@@ -412,7 +413,7 @@ func (r *DPAReconciler) validateProviderPluginAndSecret(bslSpec velerov1.BackupS
return nil
}
// check for existence of provider plugin and warn if the plugin is absent
if !pluginExistsInVeleroCR(r.dpa.Spec.Configuration.Velero.DefaultPlugins, oadpv1alpha1.DefaultPlugin(bslSpec.Provider)) {
if !pluginExistsInVeleroCR(r.dpa.Spec.Configuration.Velero.DefaultPlugins, bslSpec.Provider) {
r.Log.Info(fmt.Sprintf("%s backupstoragelocation is configured but velero plugin for %s is not present", bslSpec.Provider, bslSpec.Provider))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stillalearner changed this in VSL from a warning log and warning event to error validation. I think it makes sense to do the same for BSLs

Sachin, so there is validation here #1559 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this PR is not to change how BSLs work but to react to adding a new plugin where plugin name and provider don't match anymore. If we want to change validation rules, that should be a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateusoliveira43 @sseago Sure, Thanks ! Will create a separate PR for this validation . Noted.

@@ -155,5 +165,10 @@ func (r *DPAReconciler) ValidateVeleroPlugins(log logr.Logger) (bool, error) {
}
}
}

if foundAWSPlugin && foundLegacyAWSPlugin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change code here to something like

if slices.Contains(dpa.Spec.Configuration.Velero.DefaultPlugins, oadpv1alpha1.DefaultPluginAWS) &&
slices.Contains(dpa.Spec.Configuration.Velero.DefaultPlugins, oadpv1alpha1.DefaultPluginLegacyAWS) {

I think it is easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability is subjective here. I would find that change harder to read -- but we're already iterating over the slice once above. Adding this would mean 2 more iterations.

@sseago sseago marked this pull request as ready for review October 22, 2024 14:25
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 22, 2024
@openshift-ci openshift-ci bot requested review from mpryc and mrnold October 22, 2024 14:26
@sseago
Copy link
Contributor Author

sseago commented Oct 22, 2024

/retest

@kaovilai
Copy link
Member

TODO: Add legacy-aws to e2e

@kaovilai kaovilai mentioned this pull request Oct 22, 2024
kaovilai
kaovilai previously approved these changes Oct 22, 2024
@kaovilai
Copy link
Member

/test 4.16-e2e-test-aws

1 similar comment
@kaovilai
Copy link
Member

/test 4.16-e2e-test-aws

@@ -104,10 +104,20 @@ func (r *DPAReconciler) ValidateVeleroPlugins(log logr.Logger) (bool, error) {
}
}

foundAWSPlugin := false
foundLegacyAWSPlugin := false
for _, plugin := range dpa.Spec.Configuration.Velero.DefaultPlugins {
pluginSpecificMap, ok := credentials.PluginSpecificFields[plugin]
pluginNeedsCheck, foundInBSLorVSL := providerNeedsDefaultCreds[string(plugin)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to change here because of line 94?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateusoliveira43 You are correct again. I'll fix this.

Copy link
Contributor

@mateusoliveira43 mateusoliveira43 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran E2E tests in my IBM cluster, by changing $PROVIDER here


to legacy-aws and they all passed ✅ (did not run virt tests)

I also ran some commands like grep -Inr "DefaultPlugins" . --exclude-dir=tests --exclude=\*_test.go, and I think all necessary code changes were made, except for this question #1565 (comment)

@weshayutin
Copy link
Contributor

I ran E2E tests in my IBM cluster, by changing $PROVIDER here

to legacy-aws and they all passed ✅ (did not run virt tests)
I also ran some commands like grep -Inr "DefaultPlugins" . --exclude-dir=tests --exclude=\*_test.go, and I think all necessary code changes were made, except for this question #1565 (comment)

FYI @mateusoliveira43 If this worked for you and have completed the code review I would expect to see you vote as well sir. Thank you

@weshayutin
Copy link
Contributor

Testing will be covered here: https://issues.redhat.com/browse/OADP-5106

Copy link

openshift-ci bot commented Oct 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mateusoliveira43, shubham-pampattiwar, sseago

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [mateusoliveira43,shubham-pampattiwar,sseago]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mateusoliveira43
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2024
@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 20d8c61 and 2 for PR HEAD 2e096a5 in total

@kaovilai
Copy link
Member

/override ci/prow/4.17-e2e-test-kubevirt-aws

Copy link

openshift-ci bot commented Oct 23, 2024

@kaovilai: Overrode contexts on behalf of kaovilai: ci/prow/4.17-e2e-test-kubevirt-aws

In response to this:

/override ci/prow/4.17-e2e-test-kubevirt-aws

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@sseago
Copy link
Contributor Author

sseago commented Oct 23, 2024

/override ci/prow/4.17-e2e-test-kubevirt-aws

Copy link

openshift-ci bot commented Oct 23, 2024

@sseago: Overrode contexts on behalf of sseago: ci/prow/4.17-e2e-test-kubevirt-aws

In response to this:

/override ci/prow/4.17-e2e-test-kubevirt-aws

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 0d5ba7b into openshift:master Oct 23, 2024
21 of 22 checks passed
Copy link

openshift-ci bot commented Oct 23, 2024

@sseago: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.18-dev-preview-e2e-test-aws 2e096a5 link false /test 4.18-dev-preview-e2e-test-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

sseago added a commit to sseago/oadp-operator that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants