-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Validate namespace in velero backup create command #4057
Validate namespace in velero backup create command #4057
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @codegold79 - this is looking really good so far! I just have a couple of suggestions to expand the test coverage and also use the collections.ValidateNamespaceIncludesExcludes
function in the CLI to avoid code duplication 👍
Signed-off-by: F. Gold <fgold@vmware.com>
Signed-off-by: F. Gold <fgold@vmware.com>
Signed-off-by: F. Gold <fgold@vmware.com>
Signed-off-by: F. Gold <fgold@vmware.com>
…to read Signed-off-by: F. Gold <fgold@vmware.com>
Signed-off-by: F. Gold <fgold@vmware.com>
- use one set of namespace validation logic instead of writing two - remove duplicate namespace validation functions and tests - add namespace validation tests in includes_excludes_test.go Signed-off-by: F. Gold <fgold@vmware.com>
e42249b
to
ec5f0a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: F. Gold <fgold@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this again, @codegold79! I have one more request to help with the clarity of error messages in the output.
Signed-off-by: F. Gold <fgold@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You made those changes quickly 😄 thanks!
The requested changes were addressed in 694a64c.
@codegold79 This change breaks pure cluster-scoped resource backups using incl_clusterresources=True with incl_namespaces=[""] which used to be working until Velero 1.6. Is there an alternative for this notation - ideally one that works for previous versions, too? Maybe excl_namespaces="*" ? |
* Add namespace validation in the client Signed-off-by: F. Gold <fgold@vmware.com> * Add namespace validation in the backup controller Signed-off-by: F. Gold <fgold@vmware.com> * Add changelog for PR 4057 Signed-off-by: F. Gold <fgold@vmware.com> * Update Copyright notice Signed-off-by: F. Gold <fgold@vmware.com> * Update include_excludes_test.go to follow Go standards and be easier to read Signed-off-by: F. Gold <fgold@vmware.com> * Add unit tests for namespace validation functions Signed-off-by: F. Gold <fgold@vmware.com> * Make changes per review comments - use one set of namespace validation logic instead of writing two - remove duplicate namespace validation functions and tests - add namespace validation tests in includes_excludes_test.go Signed-off-by: F. Gold <fgold@vmware.com> * Return all ns validation err msgs as error list Signed-off-by: F. Gold <fgold@vmware.com> * Make error message more clear Signed-off-by: F. Gold <fgold@vmware.com>
* Add namespace validation in the client Signed-off-by: F. Gold <fgold@vmware.com> * Add namespace validation in the backup controller Signed-off-by: F. Gold <fgold@vmware.com> * Add changelog for PR 4057 Signed-off-by: F. Gold <fgold@vmware.com> * Update Copyright notice Signed-off-by: F. Gold <fgold@vmware.com> * Update include_excludes_test.go to follow Go standards and be easier to read Signed-off-by: F. Gold <fgold@vmware.com> * Add unit tests for namespace validation functions Signed-off-by: F. Gold <fgold@vmware.com> * Make changes per review comments - use one set of namespace validation logic instead of writing two - remove duplicate namespace validation functions and tests - add namespace validation tests in includes_excludes_test.go Signed-off-by: F. Gold <fgold@vmware.com> * Return all ns validation err msgs as error list Signed-off-by: F. Gold <fgold@vmware.com> * Make error message more clear Signed-off-by: F. Gold <fgold@vmware.com>
Please add a summary of your change
Added validation of namespaces included and excluded when creating Velero backups. The validatation was added both in the client and the server (the backup controller).
Does your change fix a particular issue?
Fixes #2690. In this issue, it was reported that when a forward slash was used in an included namespace for a backup, the backup proceeded instead of gracefully failing with useful information to the user.
Please indicate you've done the following:
/kind changelog-not-required
.site/content/docs/main
.