Skip to main content
Version: Next 🚧

Rust

Rust is the most mature programming language that can generate WebAssembly modules. WebAssembly is a first-class citizen in the Rust world so many of the tools and crates from the Rust ecosystem work out of the box.

Kubewarden provides a Rust SDK that simplifies the process of writing policies. There is also a template project to provide scaffolding for a policy project using the cargo-generate utility.

This documentation shows how to use these projects to write Kubewarden policies using Rust. It doesn't cover the details of Kubewarden's Rust SDK. The details are in the crate documentation.

Getting the Rust dependencies​

Install the Rust compiler and its tools using rustup. Refer to the rustup install documentation.

Once you have installed rustup add the WebAssembly System Interface (WASI) target:

rustup target add wasm32-wasi

OSX dependencies​

To use cargo-generate you need to add the Xcode tool set. If it isn't installed through Xcode the following command gives you the dependencies needed:

xcode-select --install