-
Notifications
You must be signed in to change notification settings - Fork 80
OADP-5079 Add support for legacy aws plugin #1565
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import ( | |
|
||
oadpv1alpha1 "github.com/openshift/oadp-operator/api/v1alpha1" | ||
"github.com/openshift/oadp-operator/pkg/common" | ||
"github.com/openshift/oadp-operator/pkg/credentials" | ||
"github.com/openshift/oadp-operator/pkg/storage/aws" | ||
) | ||
|
||
|
@@ -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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a duplication of the function changed in This function name is wrong, no? From what I see in code, DPA was called velero at some point in time. It should be There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
for _, plugin := range configuredPlugins { | ||
if plugin == expectedPlugin { | ||
if credentials.PluginSpecificFields[plugin].ProviderName == expectedProvider { | ||
return true | ||
} | ||
} | ||
|
@@ -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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
//TODO: set warning condition on Velero CR | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,9 +104,19 @@ 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)] | ||
pluginNeedsCheck, foundInBSLorVSL := providerNeedsDefaultCreds[pluginSpecificMap.ProviderName] | ||
|
||
// "aws" and "legacy-aws" cannot both be specified | ||
if plugin == oadpv1alpha1.DefaultPluginAWS { | ||
foundAWSPlugin = true | ||
} | ||
if plugin == oadpv1alpha1.DefaultPluginLegacyAWS { | ||
foundLegacyAWSPlugin = true | ||
} | ||
|
||
// check for VSM/Volsync DataMover (OADP 1.2 or below) syntax | ||
if plugin == oadpv1alpha1.DefaultPluginVSM { | ||
|
@@ -155,5 +165,10 @@ func (r *DPAReconciler) ValidateVeleroPlugins(log logr.Logger) (bool, error) { | |
} | ||
} | ||
} | ||
|
||
if foundAWSPlugin && foundLegacyAWSPlugin { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
return false, fmt.Errorf("%s and %s can not be both specified in DPA spec.configuration.velero.defaultPlugins", oadpv1alpha1.DefaultPluginAWS, oadpv1alpha1.DefaultPluginLegacyAWS) | ||
} | ||
|
||
return true, nil | ||
} |
Uh oh!
There was an error while loading. Please reload this page.