在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):garethr/kubernetes-json-schema开源软件地址(OpenSource Url):https://github.com/garethr/kubernetes-json-schema开源编程语言(OpenSource Language):开源软件介绍(OpenSource Introduction):Kubernetes JSON SchemasWhile exploring tooling for Kubernetes I had need for schemas to
describe the definition files, and went looking for something that
didn't require either It turns out that the OpenAPI specification contain this information, but not in a particularly usable format for tools which might just want a raw JSON Schema. This repository contains a set of schemas for most recent Kubernetes versions. For each specified Kubernetes versions you should find four different flavours:
Note that the Kubernetes API allows additional properties to be submitted,
but kubernetesjsonschema.devThe schemas are now all available from kubernetesjsonschema.dev, for instance the schema for v1 of the Pod object is Kubernetes 1.14.0 is available at: kubernetesjsonschema.dev/v1.14.0-standalone/pod-v1.json ExampleHere are the links to the
UsageThere are lots of use cases for these schemas, they are primarily useful as a low-level part of other developer workflow tools. But at a most basic level you can validate a Kubernetes definition. Here is a very simply example using the Python jsonschema client and an invalid deployment file:
Specific ideasAs noted these schemas have lots of potential uses for development tools. Here are a few ideas, some of which I've been hacking on:
Prior-artThe discussion around wanting JSON Schemas for Kubernetes types has cropped up in a few places, but there are some useful comments on this issue. Joël Harkes reached a similar conclusion to the approach I ended up taking. Building the schemas yourselfThe tooling for generating these schemas is openapi2jsonschema. It's not Kubernetes specific and should work with other OpenAPI APIs too. This should be useful if you're using a pre-release or otherwise modified version of Kubernetes, or something like OpenShift which extends the standard APIs with additional types. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论