feat(params): enabling paramKind and paramRef to the policy#185
feat(params): enabling paramKind and paramRef to the policy#185flavio merged 6 commits intokubewarden:mainfrom
Conversation
|
Missing to review validate.go and validate_test.go, will get to it tomorrow. |
viccuad
left a comment
There was a problem hiding this comment.
I think it would be valuable to put all the params new functions under validate/{params.go,params_test.go}.
3f6d56b to
2b41289
Compare
1a6586d to
92bb8bd
Compare
| expression: "object.spec.replicas" | ||
| validations: | ||
| - expression: "variables.replicas <= 5" | ||
| - expression: "variables.replicas <= params.data.maxreplicas" |
There was a problem hiding this comment.
I would include also the definition for the ConfigMap in this same YAML block to tie everything together. That way people don't need to know about VAPs.
There was a problem hiding this comment.
Sorry, I did not understand the request. Do you want to add a comment with an example of the params ConfigMap resource in the yaml block?
There was a problem hiding this comment.
Yes, that was the idea.
I did that for kubewarden/docs#683 on the docs. I'm conflicted, as it just grows the example. What do you think about it?
There was a problem hiding this comment.
I think we can added. It's small number of line and give a better understanding of what's going on.
flavio
left a comment
There was a problem hiding this comment.
LGTM, I left some minor comments
There was a problem hiding this comment.
LGTM! 🚀
Reminder, we still need some changes to docs.kubewarden.io. Edit: opened kubewarden/docs#683.
Adds new policy settings to allow users to define policy parameters. To address that, now the policy has new settings fields that work in the same way that Kubernetes ValidatingAdmissionPolicy works. Signed-off-by: José Guilherme Vanz <[email protected]>
Update linter version and fixes all the errors pointed by it. Signed-off-by: José Guilherme Vanz <[email protected]>
Moves the functions used to manipulate and fetch parameters to a dedicated file. And, refactor the evaluation functions to remove duplicate code to that iterate and run evaluations. Also fixes some review comments. Signed-off-by: José Guilherme Vanz <[email protected]>
Updates the e2e tests target to generate the metadata.yml file used to annonate the policy used in the e2e test run. Document this behaivour on CONTRIBUTING.md. Signed-off-by: José Guilherme Vanz <[email protected]>
Updates the evaluateValidation signature to return (ValidationResponse,error). Furthermore, fix a type and move more specific function down in the files. Signed-off-by: José Guilherme Vanz <[email protected]>
Updates the README example adding a ConfigMap definition to be used as resource parameter. Signed-off-by: José Guilherme Vanz <[email protected]>
Description
Adds new policy settings to allow users to define policy parameters. To address that, now the policy has new settings fields that work in the same way that Kubernetes ValidatingAdmissionPolicy works.
Fix #161
Test
make test e2e-test