Developing CRDs for Kubernetes, using VScode as an IDE. Want to provide autocompletion and Intellisense in IDE.
It needs a JSON schema to do so. I have a huge number of CRDs to support. I want to do it in an easy way to convert CRDs to JSON schema.
Developing CRDs for Kubernetes, using VScode as an IDE. Want to provide autocompletion and Intellisense in IDE.
It needs a JSON schema to do so. I have a huge number of CRDs to support. I want to do it in an easy way to convert CRDs to JSON schema.
You can export the swagger definition (including your CRDs) of your Kubernetes server and then generate the json schema from the swagger export.
Create a proxy to your API server and export the swagger
kubectl proxy --port=8080
curl localhost:8080/openapi/v2 > k8s-swagger.json
Using openapi2jsonschema generate the json schemas
openapi2jsonschema -o "schemas" --kubernetes --stand-alone k8s-swagger.json
You can have CRD IntelliSense thanks to vscode-kubernetes-tools extension. It will fetch CRD from the active cluster. Here is the relevant merged pull request for feature details.