kube-rs / kopium

Kubernetes OPenapI UnMangler
Apache License 2.0
115 stars 21 forks source link

Status struct is not generated if the object is empty, but preserve-unknown-fields is true #275

Open zsoli69 opened 2 months ago

zsoli69 commented 2 months ago

In case a CRD has a status property defined as the following, the status struct will not be generated.

status:
    description: Status description
    type: object
    x-kubernetes-preserve-unknown-fields: true
clux commented 2 months ago

Possibly two problems here;

We do check for the struct existing before making a status link to it (1 / 2).

Possibly we could make a type alias for status to be just Map<String, serde_json::Value> (like the other preserve_unknown things) and refer to this... It's possible this will work just work with CustomResource but not sure.

Experimentation welcome. It should be possible to mess with the analyzer to get it to produce something for it. Once the struct/type-alias is produced, it can be hooked into the #[kube(status)] line easily.

Links to the CRD that produces this is also helpful.

Note that we do support the similar case where the main struct is just unknown-fields; tested here