-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fix roletemplate.rules validation, added standard k8s checks #328
Fix roletemplate.rules validation, added standard k8s checks #328
Conversation
fix: extended field path with proper index information for validated rule chore: created unit tests for ValidateRules
note: possible superfluousness of CheckForVerbs
chore: regenerated main documentation file
note: drop/inline `validateFields` fix: fields paths reported for globalroles
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.
Q: Do we need/want to make any adjustments to corresponding integration tests?
@pmatseykanets Thank you for pointing me to this. |
142fd5c
Integrations tests extended - role templates, and global roles. |
Proper validation of GlobalRole `rules`, plus fix (TomL) to make validation not namespaced.
Issue:
See rancher/rancher#40584
Problem
As described in the referenced issue, the roletemplate rules validation performs only a subset of the checks done by k8s on policy roles (besides the rancher-specific checks). In the referenced issue this is noted for
apiGroups
. The same problem would happen for theresources
. Theverbs
field is ok, because this is checked explicitly.Solution
The chosen solution calls on k8s functionality performing the entire set of rule checks for us.
The basic ability to do so was added with #309.
The core function for doing so,
validateRules
, is moved out ofglobalrole
into thecommon
package, to keep DRY.As part of this unit tests were added. The tests pass.
After this refactor the
roletemplate
package is simply extended to call on this functionality.CheckList