From 47f58b5491c911f5f0f5d86de122a0ece1612e46 Mon Sep 17 00:00:00 2001 From: Jordan Liggitt Date: Tue, 25 Jun 2019 08:16:06 -0700 Subject: [PATCH] Add rationale for preserving persisted data for alpha fields --- contributors/devel/sig-architecture/api_changes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contributors/devel/sig-architecture/api_changes.md b/contributors/devel/sig-architecture/api_changes.md index 8bf999577..8125bd881 100644 --- a/contributors/devel/sig-architecture/api_changes.md +++ b/contributors/devel/sig-architecture/api_changes.md @@ -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