Kazan
Kazan is a Kubernetes API client for Elixir. It uses the OpenAPI specifications provided by elixir to generate most of it’s functions and datastructures. This allows the whole kube API to be supported with relatively little effort.
Kazan should mostly be functional, though it is still somewhat experimental and untested. Parts of the API may not work, and the Kazan interface may be changed at any time.
Features
- Support for most Kubernetes API calls.
- Structs for most Kubernetes API structures.
Not Implemented
- Support for watch requests.
- Comprehensive tests.
- Validation of requests
- Typespecs for functions or structs.
- Probably some other things.
Installation
If available in Hex, the package can be installed as:
-
Add
kazanto your list of dependencies inmix.exs:
```elixir
def deps do
[{:kazan, "~> 0.1.0"}]
end
```-
Ensure
kazanis started before your application:
```elixir
def application do
[applications: [:kazan]]
end
```Configuration
Assuming you’re only intendeding to communicate with a single Kubernetes server,
it’s recommended to configure this server in your config.exs:
config :kazan, :server, %{url: "kubernetes.default"}Usage
Making a request with Kazan is done in two stages.
-
Build the request object using one of the functions in
Kazan.Api.*. -
Run that request using
Kazan.Client.
For example, to get all of the pods from a server:
Kazan.Apis.CoreV1.list_pod_for_all_namespaces!
|> Kazan.Client.run!
# %Kazan.Models.V1.PodList{...}
More details on building requests can be found in the documentation for
Kazan.Apis.
All the models reutrned by the application can be found under Kazan.Models