Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add instruction to generate openapi client #138

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading