Merge pull request #3841 from liggitt/skew-alpha-fields

Add rationale for preserving persisted data for alpha fields
This commit is contained in:
Kubernetes Prow Robot 2019-07-01 12:25:21 -07:00 committed by GitHub
commit 6a41010589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -930,6 +930,9 @@ The preferred approach adds an alpha field to the existing object, and ensures i
3. Before persisting the object to storage, clear disabled alpha fields on create,
and on update if the existing object does not already have a value in the field.
This prevents new usage of the feature while it is disabled, while ensuring existing data is preserved.
Ensuring existing data is preserved is needed so that when the feature is enabled by default in a future version *n*
and data is unconditionally allowed to be persisted in the field, an *n-1* API server
(with the feature still disabled by default) will not drop the data on update.
The recommended place to do this is in the REST storage strategy's PrepareForCreate/PrepareForUpdate methods:
```go