Skip to content

Commit 3e4b476

Browse files
committed
propose initial migration types
1 parent c473f6d commit 3e4b476

File tree

1 file changed

+21
-2
lines changed
  • keps/sig-api-machinery/1027-api-unions

1 file changed

+21
-2
lines changed

keps/sig-api-machinery/1027-api-unions/README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [Go Markers](#go-markers)
2020
- [OpenAPI](#openapi)
2121
- [Normalization and Validation](#normalization-and-validation)
22+
- [Migrating existing unions](#migrating-existing-unions)
2223
- [Open Questions](#open-questions)
2324
- [Test Plan](#test-plan)
2425
- [Prerequisite testing updates](#prerequisite-testing-updates)
@@ -133,7 +134,8 @@ functions (e.g. `pkg/apis/<group>/validation/validation.go`).
133134
incomplete information
134135

135136
Another goal is to migrate at least one existing union to the new semantics in
136-
order to verify that migration is possible.
137+
order to verify that migration is possible. Ideally migrate one of each type of
138+
existing union (discriminated and non-discriminated).
137139

138140
### Non-Goals
139141

@@ -374,6 +376,22 @@ currently done for existing union types.
374376

375377
Objects must be validated AFTER the normalization process.
376378

379+
#### Migrating existing unions
380+
381+
As mentioned, one of the goals is to migrate at least one existing union to
382+
using the new marker based union validation and normalization. While open
383+
questions remain around the priority and urgency of migrating existing unions,
384+
nonetheless we should be able to come to a consensus on which types to migrate
385+
first.
386+
387+
For discriminated unions, a couple relatively straightforward discriminated types are
388+
`MetricSpec` and `MetricStatus`. These have clearly defined discriminator values
389+
that map one-to-one to a member field, which make them good candidates for
390+
initial migration.
391+
392+
For non-discriminated unions, there are a few relatively straightforward types
393+
that make good candidates for initial migration, such as `ContainerState`
394+
377395
### Open Questions
378396

379397
A few open questions exist with the design that need to be resolved with SIG API
@@ -402,7 +420,8 @@ Machinery before moving forward.
402420
4. Given that we want to migrate at least one existing union to use the new
403421
semantics, which union should we do? Must we upgrade both a discriminated and
404422
non-discriminated union for alpha or is only upgrading an existing
405-
discriminated union sufficient?
423+
discriminated union sufficient? Thoughts on my proposed types of
424+
`MetricStatus` (discriminated) and `ContainerState` (non-discriminated).
406425
5. What should we default the discriminator value of a member field to if not
407426
specified in the go markers?
408427
a. the json representation of the field name

0 commit comments

Comments
 (0)