Quick Start
1. Install KCLOpenAPI Tool
You can install the kcl-openapi tool with go install:
go install kcl-lang.io/kcl-openapi@latest
To verify the installation, you can run the command: kcl-openapi generate model -h
and the following information indicates your successful installation:
kcl-openapi command helps you to generate KCL schema structure from K8s CRD YAML/JSON file.
1. Translate Swagger Openapi Spec to KCL code
2. Translate Kubernetes CRD to KCL code
Examples:
# convert a K8s CRD file into KCL files
kcl-openapi generate model -f FILENAME --crd --skip-validation
Options:
--crd=false: Set the spec file is a kube crd
-f, --filename='': The filename to convert
--skip-validation=false: Skips validation of spec prior to generation
-t, --target='': The location to write output kcl files
--version=false: Show the KCLOpenAPI version
Usage:
kcl-openapi generate model -f FILENAME [options]