Experimental Kubernetes Operator kit written in Rust
Documentation:
This project is maintained by psFried
You’ll first need to make sure you have just a couple of pre-requisites installed
brew install openssl@1.1
sudo apt-get install pkg-config libssl-dev
. The pkg-config package is optional, but generally makes things easiersudo dnf install pkg-config openssl-devel
kubectl
commands against that cluster to ensure it all worksNow you’re ready to create a new Rust project. Run cargo new --bin example-operator
, replacing example-operator
with whatever name you want.
~/projects$ cargo new --bin example-operator
Created binary (application) `example-operator` package
This should create the following files:
example-operator/
├── Cargo.toml
└── src
└── main.rs
1 directory, 2 files
Change directory into your project and run cargo run
to ensure that everything works correctly. You should see something like the following:
~/projects/example-operator$ cargo run
Compiling example-operator v0.1.0 (/Users/pfried/projects/example-operator)
Finished dev [unoptimized + debuginfo] target(s) in 1.54s
Running `target/debug/example-operator`
Hello, world!
Edit Cargo.toml
and add the following:
[dependencies]
roperator = "*"
# There's lots of "right" ways to setup logging, so feel free to use something else. For this example, we'll use the `env_logger` crate
log = "0.4"
env_logger = "0.7"
# This is only needed if you intend to use the builtin testkit for testing your operator, which is probably a good idea
[dev-dependencies]
roperator = { version = "*", features = ["testkit"] }