Skip to content

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

Open
@zsoli69

Description

@zsoli69

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

Activity

clux

clux commented on Sep 27, 2024

@clux
Member

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

added
bugSomething isn't working
help wantedExtra attention is needed
on Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @clux@zsoli69

        Issue actions

          Status struct is not generated if the object is empty, but preserve-unknown-fields is true · Issue #275 · kube-rs/kopium