Skip to content

Optional struct literal fields in the API do not allow defaulting them via a Webhook #552

Closed
@alvaroaleman

Description

@alvaroaleman

Currently we have a set of optional struct literal fields in our API, e.G: (This is an incomplete list):

These are impossible to default via a MutatingAdmissionWebhook, because the only supported patch type currently is Jsonpatch. A jsonpatch is generated by marshalling an object original and an object current, then calculating the json patch for the diff. However the marshaled representation the Webhook that knows the types will always contain an empty object field ({}) for the optional property when it is a literal, even when omitempty is set. Consequently, the resulting Jsonpatch will not try to add the main object but only its children. This patch will then get rejected by the APIServer with an error like doc is missing path: "/spec/strategy/typebecause it doesn't know anything about the main object (here: /spec/strategy).

Metadata

Metadata

Assignees

Labels

priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions