12
12
- [ User Stories (Optional)] ( #user-stories-optional )
13
13
- [ Story 1] ( #story-1 )
14
14
- [ Story 2] ( #story-2 )
15
- - [ Story 3] ( #story-3 )
16
15
- [ Notes/Constraints/Caveats (Optional)] ( #notesconstraintscaveats-optional )
17
16
- [ Risks and Mitigations] ( #risks-and-mitigations )
18
17
- [ Design Details] ( #design-details )
@@ -132,16 +131,13 @@ members of a oneOf, in order to receive standardized:
132
131
133
132
### Non-Goals
134
133
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.
138
138
139
139
## Proposal
140
140
141
- In order to support unions in a backward compatible way in kubernetes, we're
142
- proposing the following changes.
143
-
144
-
145
141
### User Stories (Optional)
146
142
147
143
<!--
@@ -165,11 +161,6 @@ As a client, I can read, modify, and update the union fields of an object, even
165
161
if I am not aware of all of the possible fields, and the server will properly
166
162
interpret my intent.
167
163
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
-
173
164
### Notes/Constraints/Caveats (Optional)
174
165
175
166
<!--
@@ -383,6 +374,10 @@ Machinery before moving forward.
383
374
2 . What should the value of the discriminator be when no field in the union is
384
375
to be set. A couple options inclued an empty string, an field common to all
385
376
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.
386
381
387
382
### Test Plan
388
383
@@ -561,18 +556,19 @@ well as the [existing list] of feature gates.
561
556
[existing list]: https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
562
557
-->
563
558
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
+
573
567
574
568
###### Does enabling the feature change any default behavior?
575
569
570
+ No
571
+
576
572
<!--
577
573
Any change of default behavior may be surprising to users or break existing
578
574
automations, so be extremely careful here.
@@ -591,8 +587,12 @@ feature.
591
587
NOTE: Also set `disable-supported` to `true` or `false` in `kep.yaml`.
592
588
-->
593
589
590
+ Yes, requests will simply skip union validation and normalization.
591
+
594
592
###### What happens if we reenable the feature if it was previously rolled back?
595
593
594
+ Requests will resume perform union validation and normalization
595
+
596
596
###### Are there any tests for feature enablement/disablement?
597
597
598
598
<!--
@@ -616,6 +616,8 @@ This section must be completed when targeting beta to a release.
616
616
617
617
###### How can a rollout or rollback fail? Can it impact already running workloads?
618
618
619
+ N/A
620
+
619
621
<!--
620
622
Try to be as paranoid as possible - e.g., what if some components will restart
621
623
mid-rollout?
@@ -628,13 +630,15 @@ will rollout across nodes.
628
630
629
631
###### What specific metrics should inform a rollback?
630
632
633
+ N/A
631
634
<!--
632
635
What signals should users be paying attention to when the feature is young
633
636
that might indicate a serious problem?
634
637
-->
635
638
636
639
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
637
640
641
+ N/A
638
642
<!--
639
643
Describe manual testing that was done and the outcomes.
640
644
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.
643
647
644
648
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
645
649
650
+ N/A
646
651
<!--
647
652
Even if applying deprecation policies, they may still surprise some users.
648
653
-->
@@ -658,6 +663,7 @@ previous answers based on experience in the field.
658
663
659
664
###### How can an operator determine if the feature is in use by workloads?
660
665
666
+ Simply creating and updating objects with union fields.
661
667
<!--
662
668
Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
663
669
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.
666
672
667
673
###### How can someone using this feature know that it is working for their instance?
668
674
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
669
679
<!--
670
680
For instance, if this is a pod-related feature, it should be possible to determine if the feature is functioning properly
671
681
for each individual pod.
672
682
Pick one more of these and delete the rest.
673
683
Please describe all items visible to end users below with sufficient detail so that they can verify correct enablement
674
684
and operation of this feature.
675
685
Recall that end users cannot usually observe component logs or access metrics.
676
- -->
677
686
678
687
- [ ] Events
679
688
- Event Reason:
@@ -682,9 +691,12 @@ Recall that end users cannot usually observe component logs or access metrics.
682
691
- Other field:
683
692
- [ ] Other (treat as last resort)
684
693
- Details:
694
+ -->
685
695
686
696
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
687
697
698
+ N/A
699
+
688
700
<!--
689
701
This is your opportunity to define what "normal" quality of service looks like
690
702
for a feature.
@@ -702,32 +714,36 @@ question.
702
714
703
715
###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service?
704
716
717
+ N/A
705
718
<!--
706
719
Pick one more of these and delete the rest.
707
- -->
708
720
709
721
- [ ] Metrics
710
722
- Metric name:
711
723
- [Optional] Aggregation method:
712
724
- Components exposing the metric:
713
725
- [ ] Other (treat as last resort)
714
726
- Details:
727
+ -->
715
728
716
729
###### Are there any missing metrics that would be useful to have to improve observability of this feature?
717
730
731
+ N/A
718
732
<!--
719
733
Describe the metrics themselves and the reasons why they weren't added (e.g., cost,
720
734
implementation difficulties, etc.).
721
735
-->
722
736
723
737
### Dependencies
724
738
739
+
725
740
<!--
726
741
This section must be completed when targeting beta to a release.
727
742
-->
728
743
729
744
###### Does this feature depend on any specific services running in the cluster?
730
745
746
+ N/A
731
747
<!--
732
748
Think about both cluster-level services (e.g. metrics-server) as well
733
749
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):
745
761
746
762
### Scalability
747
763
764
+ N/A
748
765
<!--
749
766
For alpha, this section is encouraged: reviewers should consider these questions
750
767
and attempt to answer them.
@@ -757,6 +774,8 @@ previous answers based on experience in the field.
757
774
758
775
###### Will enabling / using this feature result in any new API calls?
759
776
777
+ No
778
+
760
779
<!--
761
780
Describe them, providing:
762
781
- API call type (e.g. PATCH pods)
@@ -772,6 +791,8 @@ Focusing mostly on:
772
791
773
792
###### Will enabling / using this feature result in introducing new API types?
774
793
794
+ No
795
+
775
796
<!--
776
797
Describe them, providing:
777
798
- API type
@@ -781,6 +802,7 @@ Describe them, providing:
781
802
782
803
###### Will enabling / using this feature result in any new calls to the cloud provider?
783
804
805
+ No
784
806
<!--
785
807
Describe them, providing:
786
808
- Which API(s):
@@ -789,6 +811,7 @@ Describe them, providing:
789
811
790
812
###### Will enabling / using this feature result in increasing size or count of the existing API objects?
791
813
814
+ No
792
815
<!--
793
816
Describe them, providing:
794
817
- API type(s):
@@ -798,6 +821,7 @@ Describe them, providing:
798
821
799
822
###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs?
800
823
824
+ No
801
825
<!--
802
826
Look at the [existing SLIs/SLOs].
803
827
@@ -809,6 +833,7 @@ Think about adding additional work or introducing new steps in between
809
833
810
834
###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components?
811
835
836
+ No
812
837
<!--
813
838
Things to keep in mind include: additional in-memory state, additional
814
839
non-trivial computations, excessive access to disks (including increased log
@@ -834,6 +859,8 @@ details). For now, we leave it here.
834
859
835
860
###### How does this feature react if the API server and/or etcd is unavailable?
836
861
862
+ N/A objects are not reachable
863
+
837
864
###### What are other known failure modes?
838
865
839
866
<!--
@@ -869,11 +896,13 @@ into a single format. We don't see a way to do so without drastically changing
869
896
existing APIs and breaking backwards compatibility
870
897
871
898
## Alternatives
872
- * Non-Discrminated
899
+
900
+ ###### Non-Discrminated
901
+
873
902
The primary alternative discussed is to not have a discriminator for new union
874
903
types. As discussed in the normalization section, requiring a discriminator
875
904
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
877
906
new fields to the union.
878
907
879
908
<!--
0 commit comments