Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kube-rs/version-rs
Example kubernetes reflector and web server with axum
https://github.com/kube-rs/version-rs
axum example kubernetes reflector
Last synced: 2 months ago
JSON representation
Example kubernetes reflector and web server with axum
- Host: GitHub
- URL: https://github.com/kube-rs/version-rs
- Owner: kube-rs
- License: apache-2.0
- Created: 2019-07-20T22:44:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T22:31:44.000Z (2 months ago)
- Last Synced: 2024-11-11T23:27:48.250Z (2 months ago)
- Topics: axum, example, kubernetes, reflector
- Language: Rust
- Homepage:
- Size: 499 KB
- Stars: 48
- Watchers: 5
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cloud-native - kube-rs/version-rs
README
# version-rs
[![ci](https://github.com/kube-rs/version-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/kube-rs/version-rs/actions/workflows/ci.yml)
[![docker image](https://img.shields.io/docker/pulls/clux/version.svg)](
https://hub.docker.com/r/clux/version/tags/)An example kube deployment [reflector](https://docs.rs/kube/latest/kube/runtime/reflector/fn.reflector.html), [watcher stream](https://docs.rs/kube/latest/kube/runtime/trait.WatchStreamExt.html), and [axum](https://github.com/tokio-rs/axum) web server in [<100 lines of rust](./version.rs). It exposes a simple version api for deployments on `/versions`.
## Usage
Clone the repo and either run locally or deploy into a cluster:### Locally
Run against your current Kubernetes context:```sh
cargo run
```### In-Cluster
Apply [deployment.yaml](./deployment.yaml), then `kubectl port-forward service/version 8000:80`### Api
Once running, the app will monitor the namespace of your context, and give you simplified version info on its web interface:```sh
$ curl 0.0.0.0:8000/versions
[{"container":"clux/controller","name":"foo-controller","version":"latest"},{"container":"alpine","name":"debugger","version":"3.13"}]$ curl 0.0.0.0:8000/versions/default/foo-controller
{"container":"clux/controller","name":"foo-controller","version":"latest"}
```## Developing
- Locally against a cluster: `cargo run`
- In-cluster: edit and `tilt up` [*](https://tilt.dev/)
- Docker build: `just build`NB: images + docker dev is `linux/amd64` only atm.