Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Add community docs (#12)
Browse files Browse the repository at this point in the history
* Add community docs

* Typo
  • Loading branch information
kflansburg authored May 26, 2021
1 parent e1b9de9 commit 5c1565f
Show file tree
Hide file tree
Showing 6 changed files with 389 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ reduces complexity.

[API Documentation](https://docs.rs/krator)

Looking for the developer guide? [Start here](docs/community/developers.md).

## Examples

[Moose Operator](crates/krator/examples)
Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
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.
7 changes: 7 additions & 0 deletions docs/community/README.md
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)
9 changes: 9 additions & 0 deletions docs/community/code-of-conduct.md
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.
112 changes: 112 additions & 0 deletions docs/community/developers.md
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.
Loading

0 comments on commit 5c1565f

Please sign in to comment.