Skip to content

Commit daa57ff

Browse files
jiahuifTim Bannister
andauthored
KEP-2887: OpenAPI Enum Types to Beta (kubernetes#3184)
* KEP-2887: PRR for beta. * revise for Beta. * clarify workaround of type aliases. * Apply suggestions from code review Co-authored-by: Tim Bannister <[email protected]> * fix failure mode of replicated API server. * externalize gengo alias issue. * mention enforcement of aliases rules. Co-authored-by: Tim Bannister <[email protected]>
1 parent 7e55759 commit daa57ff

File tree

2 files changed

+42
-20
lines changed
  • keps
    • prod-readiness/sig-api-machinery
    • sig-api-machinery/2887-openapi-enum-types

2 files changed

+42
-20
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
kep-number: 2887
22
alpha:
33
approver: "@deads2k"
4+
beta:
5+
approver: "@deads2k"

keps/sig-api-machinery/2887-openapi-enum-types/README.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ const (
351351

352352
Here, `StorageMedium` can have infinite number of possible values, which disqualify it as an enum type.
353353

354+
The parser of Go compiler and, as a result, `gengo`, does not support type aliases. See https://github.com/kubernetes/gengo/issues/224 for details.
355+
As of Kubernetes 1.23, we do not have any type aliases in kubernetes/kubernetes repo. Any attempt to add aliases would break the code generation.
356+
Example: https://github.com/kubernetes/kubernetes/pull/106300
357+
358+
However, as of 1.23, the enum marker is the only marker to be added to a type declaration, and would be the first marker to be affected.
359+
Until there is a fix to `gengo`, the enum generator has the following limitations:
360+
- the enum marker must not be added to aliases
361+
- an aliased enum type or value SHOULD NOT have comments. Otherwise, the comments will be squashed with these of the original with undefined ordering.
362+
363+
If the fix to `gengo` does not arrive in this release cycle, detection and enforcement the rules above will be added to the `verify-*.sh` scripts.
364+
354365
### Risks and Mitigations
355366

356367
<!--
@@ -522,12 +533,6 @@ Pick one of these and delete the rest.
522533
- [X] Feature gate (also fill in values in `kep.yaml`)
523534
- Feature gate name: `OpenAPIEnum`
524535
- Components depending on the feature gate: `kube-apiserver`
525-
- [ ] Other
526-
- Describe the mechanism:
527-
- Will enabling / disabling the feature require downtime of the control
528-
plane?
529-
- Will enabling / disabling the feature require downtime or reprovisioning
530-
of a node? (Do not assume `Dynamic Kubelet Config` feature is enabled).
531536

532537
###### Does enabling the feature change any default behavior?
533538

@@ -580,13 +585,18 @@ feature flags will be enabled on some API servers and not others during the
580585
rollout. Similarly, consider large clusters and how enablement/disablement
581586
will rollout across nodes.
582587
-->
588+
If the API-server has multiple replicas, with some instances not yet enabling this feature,
589+
whether the returned OpenAPI Spec contains enum types will depend on which instance handle the request
590+
which could result in inconsistent responses for the same request.
583591

584592
###### What specific metrics should inform a rollback?
585593

586594
<!--
587595
What signals should users be paying attention to when the feature is young
588596
that might indicate a serious problem?
589597
-->
598+
Standard API Server metrics apply to this feature. For example, when
599+
`apiserver_request_duration_seconds` is too high for `/openapi` endpoints.
590600

591601
###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested?
592602

@@ -596,12 +606,15 @@ Longer term, we may want to require automated upgrade/rollback tests, but we
596606
are missing a bunch of machinery and tooling and can't do that now.
597607
-->
598608

609+
Enabling, disabling, and re-enabling the feature gate yields expected outcomes.
599610
###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.?
600611

601612
<!--
602613
Even if applying deprecation policies, they may still surprise some users.
603614
-->
604615

616+
No.
617+
605618
### Monitoring Requirements
606619

607620
<!--
@@ -615,7 +628,7 @@ Ideally, this should be a metric. Operations against the Kubernetes API (e.g.,
615628
checking if there are objects with field X set) may be a last resort. Avoid
616629
logs or events for this purpose.
617630
-->
618-
631+
N/A. Workloads that query the OpenAPI specs automatically use this feature if enabled.
619632
###### How can someone using this feature know that it is working for their instance?
620633

621634
<!--
@@ -627,13 +640,8 @@ and operation of this feature.
627640
Recall that end users cannot usually observe component logs or access metrics.
628641
-->
629642

630-
- [ ] Events
631-
- Event Reason:
632-
- [ ] API .status
633-
- Condition name:
634-
- Other field:
635-
- [ ] Other (treat as last resort)
636-
- Details:
643+
- [X] Other (treat as last resort)
644+
- Details: the returned OpenAPI Spec contains enum types.
637645

638646
###### What are the reasonable SLOs (Service Level Objectives) for the enhancement?
639647

@@ -651,19 +659,17 @@ high level (needs more precise definitions) those may be things like:
651659
These goals will help you determine what you need to measure (SLIs) in the next
652660
question.
653661
-->
662+
This feature does not affect the SLO of API Server or any other components.
654663

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

657666
<!--
658667
Pick one more of these and delete the rest.
659668
-->
660669

661-
- [ ] Metrics
662-
- Metric name:
663-
- [Optional] Aggregation method:
664-
- Components exposing the metric:
665-
- [ ] Other (treat as last resort)
666-
- Details:
670+
- [X] Metrics
671+
- Metric name: apiserver_request_duration_seconds
672+
- Components exposing the metric: kube-api-server
667673

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

@@ -695,6 +701,11 @@ and creating new ones, as well as about cluster-level services (e.g. DNS):
695701
- Impact of its degraded performance or high-error rates on the feature:
696702
-->
697703

704+
- `kube-apiserver`
705+
- Usage description:
706+
- Impact of its outage on the feature: The `/openapi` endpoint is unavailable
707+
- Impact of its degraded performance or high-error rates on the feature: The `/openapi` endpoint is degraded.
708+
698709
### Scalability
699710

700711
<!--
@@ -784,6 +795,7 @@ details). For now, we leave it here.
784795
-->
785796

786797
###### How does this feature react if the API server and/or etcd is unavailable?
798+
This feature is part of API server. The feature is unavailable if API server is unavailable.
787799

788800
###### What are other known failure modes?
789801

@@ -799,9 +811,12 @@ For each of them, fill in the following information by copying the below templat
799811
Not required until feature graduated to beta.
800812
- Testing: Are there any tests for failure mode? If not, describe why.
801813
-->
814+
N/A. This feature fails if and only if the API Server becomes unavailable.
802815

803816
###### What steps should be taken if SLOs are not being met to determine the problem?
804817

818+
N/A. This feature fails if and only if the API Server becomes unavailable.
819+
805820
## Implementation History
806821

807822
<!--
@@ -815,6 +830,11 @@ Major milestones might include:
815830
- when the KEP was retired or superseded
816831
-->
817832

833+
- 09-09-2021 `Summary` and `Motivation` sections being merged, signaling SIG acceptance
834+
- 09-09-2021 `Proposal` section being merged, signaling agreement on a proposed design
835+
- 09-14-2021 Enum type generator merged as `kubernetes/kube-openapi#242`
836+
- 11-16-2021 Enum type support for OpenAPI v2 merged as #105057
837+
818838
## Drawbacks
819839

820840
<!--

0 commit comments

Comments
 (0)