Skip to content

Commit

Permalink
docs: add instruction to generate openapi client (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludusrusso authored Nov 26, 2024
1 parent cfa1263 commit 7189abf
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ View and control Kamaji with a simple user interface from the web.

![Kamaji Console](.github/images/screen.png)


## Deploy on Kubernetes

A sample manifest is available: `deploy/kamaji-console.yaml`. To deploy the console in the admin cluster, edit the manifest according to your environment and apply:
Expand Down Expand Up @@ -44,3 +43,25 @@ When reading child cluster resources, such as node, the console uses the TCP kub
When running in dev mode, using `npm run dev`, the console uses raw kubeconfig to connect to the cluster, in this way you should check that the child kubernetes API are reachable from your local development tool.

When build and deployed using docker, the console supposes to be runned inside parent kubernetes cluster, so it connects to the TCP using the tcp service fqdn in order to talk with child cluster kubernetes api.

## Generating OpenAPI client from kubernetes Spec

OpenAPI client can be generated using the [OpenAPI Generator](https://openapi-generator.tech) tool. See the [OpenAPI Generator](https://openapi-generator.tech/docs/installation) documentation for installation instructions.

The console uses the OpenAPI client generated from the kubernetes spec to interact with the kubernetes API.

First of all, you need access to a kubernetes cluster with kamaiji installed, and the kubernetes API exposed.

To expose the kubernetes API, you can use the following command:

```bash
$ kubectl proxy --port=8080
```

Then, you can generate the OpenAPI client using the following command:

```bash
openapi-generator generate -g typescript-node -i http://localhost:8080/openapi/v2 -o src/gen
```

The generated client will be placed in the `src/gen` directory.

0 comments on commit 7189abf

Please sign in to comment.