Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zsoli69 opened this issue Sep 24, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@zsoli69
Copy link

zsoli69 commented Sep 24, 2024

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
Copy link
Member

clux commented Sep 27, 2024

Possibly two problems here;

  • the status struct is not generated (looks like it)
  • the (would-be) preserve-unknown Map type is not checked for before linking it with a #[kube(status = ThatMap)]

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

@clux clux added bug Something isn't working help wanted Extra attention is needed labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants