Skip to content

Commit

Permalink
Add per version field section to custom resource webhook conversion KEP
Browse files Browse the repository at this point in the history
  • Loading branch information
mbohlool committed Oct 2, 2018
1 parent f70574f commit 567ac61
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,25 @@ type CustomResourceConversionWebhook {
### Defaulting

In case that there is no versions list, a single version with values defaulted to top level version will be created. That means a single version with a name set to spec.version.
All newly added per version fields (schema, additionalPrinterColumns or subresources) will be defaulted to the coresponding top level field except for the first version in the list that will remain empty.
None of the added per version fields (schema, additionalPrinterColumns or subresources) will be defaulted to the coresponding top level field except because that is a backward incompatible change.

### Top level fields to Per-Version fields

The new per version fields (schema, additionalPrinterColumns or subresources) that we are going to call X in this section cannot be defaulted to
top level fields because that would be a backward incompatible change.

Quoting from API [guidelines](https://github.com/kubernetes/community/blob/master/contributors/devel/api_changes.md#backward-compatibility-gotchas):

> A single feature/property cannot be represented using multiple spec fields in the same API version simultaneously
Hence the defaulting either implicit or explicit has the potential to break backward compatibility as we have two sets of fields representing the same feature. Refer to [this document](http://bit.ly/k8s-crd-per-version-defaulting) for more details.

The solution is to keep the two sets of fields mutally exculsive by applying these validation/mutation rules:

* *Validation*: Either top level X or per version X can be set not both.
* *Mutation*: On update, if the top level field is set, clear all per version X.

With this suggestion, there can be a single list in CRD-V1 (apiextensions.k8s.io/v1). If top level fields are set, they will be copied to all items in the list otherwise we use `spec.versions` list.


### Validation
Expand Down

0 comments on commit 567ac61

Please sign in to comment.