项目作者: tsloughter

项目描述 :
Erlang Kubernetes client
高级语言: Erlang
项目地址: git://github.com/tsloughter/kuberl.git
创建时间: 2017-12-26T20:20:45Z
项目社区:https://github.com/tsloughter/kuberl

开源协议:

下载


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:

  1. [{kuberl, [{api_key, <<"... bearer token ...">>},
  2. {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:

  1. Cfg = kuberl:cfg_with_bearer_token(kuberl:cfg_with_host("https://x.x.x.x"), <<"... bearer token ...">>),
  2. kuberl_core_api:get_api_versions(ctx:background(), #{cfg => Cfg}).

Optionally the environment config can be overridden at runtime:

  1. 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:

  1. 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.

  1. # Run the lorri daemon
  2. lorri daemon
  3. # or watch this directory (once)
  4. lorri watch # --once
  5. # load the environment
  6. direnv allow
  7. # generate the code
  8. kuberl_gen

kuberl_gen will generate the code to a temporary directory under /tmp and then copy only the modules to gen/.