This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
389 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Krator documentation | ||
|
||
[API Documentation](https://docs.rs/krator) | ||
|
||
## Table of Contents | ||
|
||
- [Community Guides](community/README.md) teach you about the development | ||
process for Krator and how you can contribute to the project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Community Guides | ||
|
||
Interested in contributing to Krator? Start here: | ||
|
||
- [Code of Conduct](code-of-conduct.md) | ||
- [Developer Guide](developers.md) | ||
- [Release Checklist](release-checklist.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Code of Conduct | ||
|
||
This project has adopted the [Microsoft Open Source Code of | ||
Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
|
||
For more information see the [Code of Conduct | ||
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact | ||
[[email protected]](mailto:[email protected]) with any additional | ||
questions or comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Developer guide | ||
|
||
This guide explains how to set up your environment for developing Krator. | ||
|
||
## Prerequisites | ||
|
||
To build Krator, you will need | ||
|
||
- The latest stable version of Rust | ||
- openssl (Or use the [`rustls-tls`](#building-without-openssl) feature) | ||
- git | ||
|
||
If you want to test Krator, you will also require | ||
|
||
- A Kubernetes cluster. | ||
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) | ||
|
||
## Building | ||
|
||
We use `cargo` to build our programs: | ||
|
||
```console | ||
$ cargo build | ||
``` | ||
|
||
### Building without openssl | ||
|
||
If you are on a system that doesn't have OpenSSL (or has the incorrect version), | ||
you have the option to build Krator using the Rustls project (Rust native TLS | ||
implementation): | ||
|
||
```console | ||
$ cargo build --no-default-features --features rustls-tls | ||
``` | ||
|
||
The same flags can be passed to `cargo run` if you want to just [run](#running) | ||
the project instead. | ||
|
||
#### Caveats | ||
|
||
The underlying dependencies for Rustls do not support certs with IP SANs | ||
(subject alternate names). Because of this, the serving certs requested during | ||
bootstrap will not work for local development options like minikube or KinD as | ||
they do not have an FQDN | ||
|
||
### Building on WSL (Windows Subsystem for Linux) | ||
|
||
You can build Krator on WSL but will need a few prerequisites that aren't | ||
included in the Ubuntu distro in the Microsoft Store: | ||
|
||
```console | ||
$ sudo apt install build-essential libssl-dev pkg-config | ||
``` | ||
|
||
**NOTE:** We've had mixed success developing Krator on WSL. It has been | ||
successfully run on WSL2 using the WSL2-enabled Docker Kubernetes or Azure | ||
Kubernetes. If you're on WSL1 you may be better off running in a full Linux VM | ||
under Hyper-V. | ||
|
||
### Building on Windows | ||
|
||
We have support for building on Windows using PowerShell: | ||
|
||
```console | ||
$ cargo build --no-default-features --features rustls-tls | ||
``` | ||
|
||
**NOTE:** Windows builds use the `rustls` library, which means there are some | ||
things to be aware of. See the [caveats](#caveats) section for more details | ||
|
||
## Running | ||
|
||
The included example with Krator is the [moose example](/krator/examples). | ||
|
||
``` | ||
cargo run --example moose | ||
``` | ||
|
||
## Testing | ||
|
||
Krator contains both unit tests and doc tests, and is routinely checked using | ||
`clippy` and `rustfmt` as well. | ||
|
||
For unit tests: | ||
|
||
```console | ||
$ cargo test --workspace | ||
``` | ||
|
||
For doc tests: | ||
|
||
```console | ||
$ cargo test --doc --all | ||
``` | ||
|
||
For `clippy`: | ||
|
||
```console | ||
$ cargo clippy --workspace | ||
``` | ||
|
||
For `rustfmt`: | ||
|
||
```console | ||
cargo fmt --all -- --check | ||
``` | ||
|
||
## Creating your own Operators with Krator | ||
|
||
If you want to create your own Operator based on Krator, all you need to do is | ||
implement an `Operator`. See the [moose example](/krator/examples/moose.rs) to | ||
see how this is done. |
Oops, something went wrong.