Closed flavio closed 3 years ago
Created https://github.com/kubewarden/policy-rust-template. Still WIP. Will ping here when can be reviewed.
Done, you can try it like:
ereslibre@desktop ~/test> cargo-generate generate --git https://github.com/kubewarden/policy-rust-template.git
🤷 Project Name : my-policy
🔧 Creating project called `my-policy`...
✨ Done! New project created /home/ereslibre/test/my-policy
Then:
ereslibre@desktop ~/test> cd my-policy/
ereslibre@desktop ~/test> make
fmt
and clippy
should be happy with the default project. The given example is extremely simple and only tries to demarshal a Pod
and check its name. If the pod name is invalid-pod-name
it will be rejected, in any other case (other name, or cannot be unmarshaled to a pod, so it's any other type of resource), the request will be accepted.
Use cargo-generate to provide an easy way to create a new Kubewarden Rust based policy.
This lowers the barrier to begin writing new policies.