Skip to content

Commit

Permalink
Update generate_from_k8s_spec.md
Browse files Browse the repository at this point in the history
  • Loading branch information
amyXia1994 authored Jul 18, 2023
1 parent a2418ab commit 10dcc91
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/generate_from_k8s_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ This guide shows how the `k8s` packages are generated. Alternatively, you could

If you want to manually generate them, please continue the guide.

Here's a one-click command to generate from kubernetes 1.27 API, and the generated package will reside in the `models/k8s` directory:
Here's a one-click command to generate from kubernetes 1.27.0 API, and the generated package will reside in the `models/k8s` directory:

```shell
version=1.27
version=1.27.0
spec_path=swagger.json
script_path=main.py
wget https://raw.githubusercontent.com/kubernetes/kubernetes/release-${version}/api/openapi-spec/swagger.json -O swagger.json
wget https://raw.githubusercontent.com/kubernetes/kubernetes/v${version}/api/openapi-spec/swagger.json -O swagger.json
wget https://raw.githubusercontent.com/kcl-lang/kcl-openapi/main/scripts/preprocess/main.py -O main.py
python3 ${script_path} ${spec_path} --omit-status --rename=io.k8s=k8s
kcl-openapi generate model -f processed-${spec_path}
Expand All @@ -20,7 +20,7 @@ For step-by-step generation, please follow the steps below:

## 1. Download the OpenAPI Spec

Download the Kubernetes OpenAPI Spec from Github. In this guide, we'll generate from the [Kubernetes v1.27 spec](https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.27/api/openapi-spec/swagger.json)
Download the Kubernetes OpenAPI Spec from Github. In this guide, we'll generate from the [Kubernetes v1.27.0 spec](https://raw.githubusercontent.com/kubernetes/kubernetes/v1.27.0/api/openapi-spec/swagger.json)


## 2. Pre-process the Spec
Expand All @@ -43,4 +43,4 @@ The generated package `k8s` could be fould at `<your work directory>/models`

## 4. Use KPM to Share the Packgae

After generating, you can refer to [How to Share Your Package using kpm](https://github.com/kcl-lang/kpm/blob/main/docs/publish_your_kcl_packages.md) to publish the package.
After generating, you can refer to [How to Share Your Package using kpm](https://github.com/kcl-lang/kpm/blob/main/docs/publish_your_kcl_packages.md) to publish the package.

0 comments on commit 10dcc91

Please sign in to comment.