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

Add x-kubernetes-preserve-unknown-field to a CRD #458

Closed
lburgazzoli opened this issue Aug 1, 2021 · 5 comments
Closed

Add x-kubernetes-preserve-unknown-field to a CRD #458

lburgazzoli opened this issue Aug 1, 2021 · 5 comments
Assignees
Labels
fabric8 lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@lburgazzoli
Copy link
Collaborator

I have a CRD where I need to include some unspecified fields, and I come up with something like:

class MySpec {
    String foo;
    Map<String, JsonNode> additionalProperties;
    
    @JsonProperty
    public void setFoo(String foo) {...}
    @JsonProperty
    public void getFoo() {...}
          
    @JsonAnySetter
    public void setAdditionalProperty(String key, JsonNode value) {...}

    @JsonAnyGetter
    public Map<String, JsonNode> getAdditionalProperties() {...}
}

However, as the generated CRD yaml, does not specify x-kubernetes-preserve-unknown-field, all unspecified fields are pruned so i.e. when I'm dogin kubectl get myresource, the only field that it is shown is foo.

Is there a way to declare that x-kubernetes-preserve-unknown-field should be set ?

@metacosm metacosm changed the title Ass x-kubernetes-preserve-unknown-field to a CRD Add x-kubernetes-preserve-unknown-field to a CRD Aug 2, 2021
@metacosm
Copy link
Collaborator

metacosm commented Aug 2, 2021

Not at this point. One thing to note, though, additionalProperties is supposed to be mutually exclusive with the properties field in the CRD JSONSchema so I'm not sure how that would work out. I've created a fabric8 client ticket, which is where this would be dealt with.

@andreaTP
Copy link
Collaborator

andreaTP commented Jan 7, 2022

This feature have been actually implemented in the kubernetes-client:

fabric8io/kubernetes-client#3684
fabric8io/kubernetes-client#3691

@github-actions
Copy link

github-actions bot commented Mar 9, 2022

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 9, 2022
@andreaTP
Copy link
Collaborator

andreaTP commented Mar 9, 2022

This issue is fixed since everything got merged in kubernetes-client and JOSDK updated it. cc. @csviri

@metacosm
Copy link
Collaborator

metacosm commented Mar 9, 2022

Thanks for confirming, @andreaTP!

@metacosm metacosm closed this as completed Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fabric8 lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants