Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsloughter/kuberl
Erlang Kubernetes client
https://github.com/tsloughter/kuberl
erlang kubernetes kubernetes-controller
Last synced: about 2 months ago
JSON representation
Erlang Kubernetes client
- Host: GitHub
- URL: https://github.com/tsloughter/kuberl
- Owner: tsloughter
- Created: 2017-12-26T20:20:45.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T13:18:14.000Z (over 4 years ago)
- Last Synced: 2024-03-14T20:52:22.597Z (10 months ago)
- Topics: erlang, kubernetes, kubernetes-controller
- Language: Erlang
- Size: 641 KB
- Stars: 54
- Watchers: 6
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Erlang Kubernetes client
Erlang client for Kubernetes 1.16 generated through Swagger.
## Watch Behaviour
The behaviour `kuberl_watch` starts a process to stream the results of a watch requests and calls the callback `handle_event` with the notification type (added, modified, deleted) and the resource object.
## Using the API
#### Configuration
The API server endpoint and key can be configured in environment configuration variables:
```erlang
[{kuberl, [{api_key, <<"... bearer token ...">>},
{host, "https://x.x.x.x"}]}].
```This will set a default configuration used if none is passed to API requests.
A new configuration can be created with functions in `kuberl`:
```erlang
Cfg = kuberl:cfg_with_bearer_token(kuberl:cfg_with_host("https://x.x.x.x"), <<"... bearer token ...">>),
kuberl_core_api:get_api_versions(ctx:background(), #{cfg => Cfg}).
```Optionally the environment config can be overridden at runtime:
```erlang
kuberl:set_default_cfg(Cfg).
```## Update Generated Code
### Without Nix
With [swagger-codegen] built under `../swagger-codegen` the script in the `bin` directory can be used to update the generated Erlang modules:
```shell
bin/update-generated-code.sh
```This script will generate the code to a temporary directory under `/tmp` and then copy only the modules to `gen/`.
### With Nix
Install [Nix], [direnv], and [lorri].
```shell
# Run the lorri daemon
lorri daemon# or watch this directory (once)
lorri watch # --once# load the environment
direnv allow# generate the code
kuberl_gen
````kuberl_gen` will generate the code to a temporary directory under `/tmp` and then copy only the modules to `gen/`.
[Nix]: https://nixos.org/
[direnv]: https://direnv.net/
[lorri]: https://github.com/target/lorri/
[swagger-codegen]: https://github.com/swagger-api/swagger-codegen/