Skip to content

Commit 85c40c0

Browse files
committed
update kep
1 parent e31cd19 commit 85c40c0

File tree

3 files changed

+70
-32
lines changed

3 files changed

+70
-32
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kep-number: 1027
2+
alpha:
3+
approver: "@deads2k"

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

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
- [User Stories (Optional)](#user-stories-optional)
1313
- [Story 1](#story-1)
1414
- [Story 2](#story-2)
15-
- [Story 3](#story-3)
1615
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
1716
- [Risks and Mitigations](#risks-and-mitigations)
1817
- [Design Details](#design-details)
@@ -132,16 +131,13 @@ members of a oneOf, in order to receive standardized:
132131

133132
### Non-Goals
134133

135-
A priority will be minimum disruption to existing types rather than ensuring all
136-
existing types conform to a single union paradigm (i.e. unions without a
137-
discriminator should continue to not need a discriminator)
134+
The focus of this KEP is on providing unified validation and normalization of
135+
new union types. Migrating existing unions away from their bespoke validation
136+
logic (e.g validation functions), is an explicit non-goal and will be pursued in
137+
a separate KEP or later release.
138138

139139
## Proposal
140140

141-
In order to support unions in a backward compatible way in kubernetes, we're
142-
proposing the following changes.
143-
144-
145141
### User Stories (Optional)
146142

147143
<!--
@@ -165,11 +161,6 @@ As a client, I can read, modify, and update the union fields of an object, even
165161
if I am not aware of all of the possible fields, and the server will properly
166162
interpret my intent.
167163

168-
#### Story 3
169-
170-
As a maintainer of existing builtin APIs, I should be able to add new fields to
171-
a union and have it behave as expected.
172-
173164
### Notes/Constraints/Caveats (Optional)
174165

175166
<!--
@@ -383,6 +374,10 @@ Machinery before moving forward.
383374
2. What should the value of the discriminator be when no field in the union is
384375
to be set. A couple options inclued an empty string, an field common to all
385376
union (e.g. "NONE"), or a field specified on a per union basis.
377+
3. How should a server behave when it receives a union with multiple fields set
378+
and the discriminator pointing to one of them? Reject the request, accept the
379+
request but don't clear the fields, or automatically clear the fields not
380+
specified by the discriminator.
386381

387382
### Test Plan
388383

@@ -561,18 +556,19 @@ well as the [existing list] of feature gates.
561556
[existing list]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
562557
-->
563558

564-
- [ ] Feature gate (also fill in values in `kep.yaml`)
565-
- Feature gate name:
566-
- Components depending on the feature gate:
567-
- [ ] Other
568-
- Describe the mechanism:
569-
- Will enabling / disabling the feature require downtime of the control
570-
plane?
571-
- Will enabling / disabling the feature require downtime or reprovisioning
572-
of a node? (Do not assume `Dynamic Kubelet Config` feature is enabled).
559+
- [x] Feature gate (also fill in values in `kep.yaml`)
560+
- Feature gate name: APIUnions
561+
- Components depending on the feature gate: kube-apiserver
562+
563+
Request handlers in the api server will call into union validation and
564+
normalization function from the structured-merge-diff repo when feature is
565+
enabled.
566+
573567

574568
###### Does enabling the feature change any default behavior?
575569

570+
No
571+
576572
<!--
577573
Any change of default behavior may be surprising to users or break existing
578574
automations, so be extremely careful here.
@@ -591,8 +587,12 @@ feature.
591587
NOTE: Also set `disable-supported` to `true` or `false` in `kep.yaml`.
592588
-->
593589

590+
Yes, requests will simply skip union validation and normalization.
591+
594592
###### What happens if we reenable the feature if it was previously rolled back?
595593

594+
Requests will resume perform union validation and normalization
595+
596596
###### Are there any tests for feature enablement/disablement?
597597

598598
<!--
@@ -616,6 +616,8 @@ This section must be completed when targeting beta to a release.
616616

617617
###### How can a rollout or rollback fail? Can it impact already running workloads?
618618

619+
N/A
620+
619621
<!--
620622
Try to be as paranoid as possible - e.g., what if some components will restart
621623
mid-rollout?
@@ -628,13 +630,15 @@ will rollout across nodes.
628630

629631
###### What specific metrics should inform a rollback?
630632

633+
N/A
631634
<!--
632635
What signals should users be paying attention to when the feature is young
633636
that might indicate a serious problem?
634637
-->
635638

636639
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
637640

641+
N/A
638642
<!--
639643
Describe manual testing that was done and the outcomes.
640644
Longer term, we may want to require automated upgrade/rollback tests, but we
@@ -643,6 +647,7 @@ are missing a bunch of machinery and tooling and can't do that now.
643647

644648
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
645649

650+
N/A
646651
<!--
647652
Even if applying deprecation policies, they may still surprise some users.
648653
-->
@@ -658,6 +663,7 @@ previous answers based on experience in the field.
658663

659664
###### How can an operator determine if the feature is in use by workloads?
660665

666+
Simply creating and updating objects with union fields.
661667
<!--
662668
Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
663669
checking if there are objects with field X set) may be a last resort. Avoid
@@ -666,14 +672,17 @@ logs or events for this purpose.
666672

667673
###### How can someone using this feature know that it is working for their instance?
668674

675+
1. Create a new CRD with a union field
676+
2. Apply the CRD
677+
3. Create a CR with an invalid union (multiple fields set, no discriminator
678+
set), see if the CR is rejected via union validation
669679
<!--
670680
For instance, if this is a pod-related feature, it should be possible to determine if the feature is functioning properly
671681
for each individual pod.
672682
Pick one more of these and delete the rest.
673683
Please describe all items visible to end users below with sufficient detail so that they can verify correct enablement
674684
and operation of this feature.
675685
Recall that end users cannot usually observe component logs or access metrics.
676-
-->
677686
678687
- [ ] Events
679688
- Event Reason:
@@ -682,9 +691,12 @@ Recall that end users cannot usually observe component logs or access metrics.
682691
- Other field:
683692
- [ ] Other (treat as last resort)
684693
- Details:
694+
-->
685695

686696
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
687697

698+
N/A
699+
688700
<!--
689701
This is your opportunity to define what "normal" quality of service looks like
690702
for a feature.
@@ -702,32 +714,36 @@ question.
702714

703715
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
704716

717+
N/A
705718
<!--
706719
Pick one more of these and delete the rest.
707-
-->
708720
709721
- [ ] Metrics
710722
- Metric name:
711723
- [Optional] Aggregation method:
712724
- Components exposing the metric:
713725
- [ ] Other (treat as last resort)
714726
- Details:
727+
-->
715728

716729
###### Are there any missing metrics that would be useful to have to improve observability of this feature?
717730

731+
N/A
718732
<!--
719733
Describe the metrics themselves and the reasons why they weren't added (e.g., cost,
720734
implementation difficulties, etc.).
721735
-->
722736

723737
### Dependencies
724738

739+
725740
<!--
726741
This section must be completed when targeting beta to a release.
727742
-->
728743

729744
###### Does this feature depend on any specific services running in the cluster?
730745

746+
N/A
731747
<!--
732748
Think about both cluster-level services (e.g. metrics-server) as well
733749
as node-level agents (e.g. specific version of CRI). Focus on external or
@@ -745,6 +761,7 @@ and creating new ones, as well as about cluster-level services (e.g. DNS):
745761

746762
### Scalability
747763

764+
N/A
748765
<!--
749766
For alpha, this section is encouraged: reviewers should consider these questions
750767
and attempt to answer them.
@@ -757,6 +774,8 @@ previous answers based on experience in the field.
757774

758775
###### Will enabling / using this feature result in any new API calls?
759776

777+
No
778+
760779
<!--
761780
Describe them, providing:
762781
- API call type (e.g. PATCH pods)
@@ -772,6 +791,8 @@ Focusing mostly on:
772791

773792
###### Will enabling / using this feature result in introducing new API types?
774793

794+
No
795+
775796
<!--
776797
Describe them, providing:
777798
- API type
@@ -781,6 +802,7 @@ Describe them, providing:
781802

782803
###### Will enabling / using this feature result in any new calls to the cloud provider?
783804

805+
No
784806
<!--
785807
Describe them, providing:
786808
- Which API(s):
@@ -789,6 +811,7 @@ Describe them, providing:
789811

790812
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
791813

814+
No
792815
<!--
793816
Describe them, providing:
794817
- API type(s):
@@ -798,6 +821,7 @@ Describe them, providing:
798821

799822
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
800823

824+
No
801825
<!--
802826
Look at the [existing SLIs/SLOs].
803827
@@ -809,6 +833,7 @@ Think about adding additional work or introducing new steps in between
809833

810834
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
811835

836+
No
812837
<!--
813838
Things to keep in mind include: additional in-memory state, additional
814839
non-trivial computations, excessive access to disks (including increased log
@@ -834,6 +859,8 @@ details). For now, we leave it here.
834859

835860
###### How does this feature react if the API server and/or etcd is unavailable?
836861

862+
N/A objects are not reachable
863+
837864
###### What are other known failure modes?
838865

839866
<!--
@@ -869,11 +896,13 @@ into a single format. We don't see a way to do so without drastically changing
869896
existing APIs and breaking backwards compatibility
870897

871898
## Alternatives
872-
* Non-Discrminated
899+
900+
###### Non-Discrminated
901+
873902
The primary alternative discussed is to not have a discriminator for new union
874903
types. As discussed in the normalization section, requiring a discriminator
875904
allows the server to better understand the intentions of clients that do not
876-
have knowledge of all the fields in a union if newer verisons of the server add
905+
have knowledge of all the fields in a union if newer versions of the server add
877906
new fields to the union.
878907

879908
<!--

keps/sig-api-machinery/1027-api-unions/kep.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,28 @@ authors:
55
- "@kevindelgado"
66
owning-sig: sig-api-machinery
77
participating-sigs:
8+
status: implementable
9+
creation-date: 2019-03-25
10+
last-updated: 2022-06-13
811
reviewers:
912
- "@sttts"
1013
- "@lavalamp"
1114
- "@thockin"
1215
- "@DirectXMan12"
1316
approvers:
1417
- "@lavalamp"
15-
editor: TBD
16-
creation-date: 2019-03-25
17-
last-updated: 2022-06-09
18-
status: implementable
18+
- "@deads2k"
19+
1920
see-also:
2021
- "/keps/sig-api-machinery/0006-apply.md"
2122
replaces:
2223
- "https://docs.google.com/document/d/1lrV-P25ZTWukixE9ZWyvchfFR0NE2eCHlObiCUgNQGQ"
23-
superseded-by:
2424

25-
latest-milestone: "1.25"
2625
stage: "alpha"
26+
latest-milestone: "1.25"
27+
28+
feature-gates:
29+
- name: APIUnions
30+
components:
31+
- kube-apiserver
32+
disable-supported: true

0 commit comments

Comments
 (0)