Replies: 1 comment
-
There is a limitation in crd schemas atm; you cannot use Maybe there is some smart property we could use to signal from kube-derive in the mean time, but kube-derive kind of just acts on the root spec struct, so it doesn't really know about what you are reusing in substructs (nested deeply below the spec), so I imagine it'd be awkward to try to solve it there. If you already have rust code, then presumably the rust code is ideally already deduplicated (i.e. using the same Otherwise, I am silently hoping that gateway api folks can help find a way to signal this. See this issue for context: kube-rs/gateway-api-rs#38 . |
Beta Was this translation helpful? Give feedback.
-
I'm looking at creating a tool to display API documentation for kubernetes types (specifically CRDs in my case), similar to https://kubespec.dev/
Most of the information I need is available in the schema in the cluster, but there is one detail that I haven't found a good solution for.
When different fields in a spec uses the same type, I have no way to detect that and refer to the same type in the documentation. Instead I end up describing the same fields over and over again.
For an instance of what I'm talking about, consider
liveness
,readiness
andstartup
fields onDeployment
. These are all the sameProbe
type, just located in different places in the schema. In the schemas for the native kubernetes types that kind of thing is solved by using component references for all complex types, which then always point to the same component.This has the added benefit of naming all the types, which again helps when generating documentation from the schema.
How hard would it be for kube-derive to create components of all structs and use references instead of inlining the schemas?
Is it possible to do today without manually building the entire schema?
If all CRDs did this, kopium could make use of these to generate structs with better names and less duplication too.
Seeing as changing all CRDs is maybe a bit optimistic, making kube-derive do it could be a nice value-add and first step. 🙂
Beta Was this translation helpful? Give feedback.
All reactions