Skip to content

Commit 0da9f97

Browse files
authored
Merge pull request kubernetes#3137 from deads2k/beta-off-by-default
KEP-3136: beta apis off by default
2 parents e139ba7 + f73839c commit 0da9f97

File tree

3 files changed

+360
-0
lines changed

3 files changed

+360
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kep-number: 3136
2+
stable:
3+
approver: "@wojtek-t"
Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
<!--
2+
**Note:** When your KEP is complete, all of these comment blocks should be removed.
3+
4+
To get started with this template:
5+
6+
- [ ] **Pick a hosting SIG.**
7+
Make sure that the problem space is something the SIG is interested in taking
8+
up. KEPs should not be checked in without a sponsoring SIG.
9+
- [ ] **Create an issue in kubernetes/enhancements**
10+
When filing an enhancement tracking issue, please make sure to complete all
11+
fields in that template. One of the fields asks for a link to the KEP. You
12+
can leave that blank until this KEP is filed, and then go back to the
13+
enhancement and add the link.
14+
- [ ] **Make a copy of this template directory.**
15+
Copy this template into the owning SIG's directory and name it
16+
`NNNN-short-descriptive-title`, where `NNNN` is the issue number (with no
17+
leading-zero padding) assigned to your enhancement above.
18+
- [ ] **Fill out as much of the kep.yaml file as you can.**
19+
At minimum, you should fill in the "Title", "Authors", "Owning-sig",
20+
"Status", and date-related fields.
21+
- [ ] **Fill out this file as best you can.**
22+
At minimum, you should fill in the "Summary" and "Motivation" sections.
23+
These should be easy if you've preflighted the idea of the KEP with the
24+
appropriate SIG(s).
25+
- [ ] **Create a PR for this KEP.**
26+
Assign it to people in the SIG who are sponsoring this process.
27+
- [ ] **Merge early and iterate.**
28+
Avoid getting hung up on specific details and instead aim to get the goals of
29+
the KEP clarified and merged quickly. The best way to do this is to just
30+
start with the high-level sections and fill out details incrementally in
31+
subsequent PRs.
32+
33+
Just because a KEP is merged does not mean it is complete or approved. Any KEP
34+
marked as `provisional` is a working document and subject to change. You can
35+
denote sections that are under active debate as follows:
36+
37+
```
38+
<<[UNRESOLVED optional short context or usernames ]>>
39+
Stuff that is being argued.
40+
<<[/UNRESOLVED]>>
41+
```
42+
43+
When editing KEPS, aim for tightly-scoped, single-topic PRs to keep discussions
44+
focused. If you disagree with what is already in a document, open a new PR
45+
with suggested changes.
46+
47+
One KEP corresponds to one "feature" or "enhancement" for its whole lifecycle.
48+
You do not need a new KEP to move from beta to GA, for example. If
49+
new details emerge that belong in the KEP, edit the KEP. Once a feature has become
50+
"implemented", major changes should get new KEPs.
51+
52+
The canonical place for the latest set of instructions (and the likely source
53+
of this file) is [here](/keps/NNNN-kep-template/README.md).
54+
55+
**Note:** Any PRs to move a KEP to `implementable`, or significant changes once
56+
it is marked `implementable`, must be approved by each of the KEP approvers.
57+
If none of those approvers are still appropriate, then changes to that list
58+
should be approved by the remaining approvers and/or the owning SIG (or
59+
SIG Architecture for cross-cutting KEPs).
60+
-->
61+
# KEP-3136: Beta APIs Are Off by Default
62+
63+
<!--
64+
This is the title of your KEP. Keep it short, simple, and descriptive. A good
65+
title can help communicate what the KEP is and should be considered as part of
66+
any review.
67+
-->
68+
69+
<!--
70+
A table of contents is helpful for quickly jumping to sections of a KEP and for
71+
highlighting any additional information provided beyond the standard KEP
72+
template.
73+
74+
Ensure the TOC is wrapped with
75+
<code>&lt;!-- toc --&rt;&lt;!-- /toc --&rt;</code>
76+
tags, and then generate with `hack/update-toc.sh`.
77+
-->
78+
79+
<!-- toc -->
80+
- [Release Signoff Checklist](#release-signoff-checklist)
81+
- [Summary](#summary)
82+
- [Motivation](#motivation)
83+
- [Goals](#goals)
84+
- [Non-Goals](#non-goals)
85+
- [Proposal](#proposal)
86+
- [User Stories (Optional)](#user-stories-optional)
87+
- [Story 1](#story-1)
88+
- [Story 2](#story-2)
89+
- [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional)
90+
- [Risks and Mitigations](#risks-and-mitigations)
91+
- [Design Details](#design-details)
92+
- [Test Plan](#test-plan)
93+
- [Graduation Criteria](#graduation-criteria)
94+
- [GA](#ga)
95+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
96+
- [Version Skew Strategy](#version-skew-strategy)
97+
- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire)
98+
- [Implementation History](#implementation-history)
99+
- [Drawbacks](#drawbacks)
100+
- [Alternatives](#alternatives)
101+
- [Infrastructure Needed (Optional)](#infrastructure-needed-optional)
102+
<!-- /toc -->
103+
104+
## Release Signoff Checklist
105+
106+
<!--
107+
**ACTION REQUIRED:** In order to merge code into a release, there must be an
108+
issue in [kubernetes/enhancements] referencing this KEP and targeting a release
109+
milestone **before the [Enhancement Freeze](https://git.k8s.io/sig-release/releases)
110+
of the targeted release**.
111+
112+
For enhancements that make changes to code or processes/procedures in core
113+
Kubernetes—i.e., [kubernetes/kubernetes], we require the following Release
114+
Signoff checklist to be completed.
115+
116+
Check these off as they are completed for the Release Team to track. These
117+
checklist items _must_ be updated for the enhancement to be released.
118+
-->
119+
120+
Items marked with (R) are required *prior to targeting to a milestone / release*.
121+
122+
- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
123+
- [ ] (R) KEP approvers have approved the KEP status as `implementable`
124+
- [ ] (R) Design details are appropriately documented
125+
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
126+
- [ ] e2e Tests for all Beta API Operations (endpoints)
127+
- [ ] (R) Ensure GA e2e tests for meet requirements for [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
128+
- [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
129+
- [ ] (R) Graduation criteria is in place
130+
- [ ] (R) [all GA Endpoints](https://github.com/kubernetes/community/pull/1806) must be hit by [Conformance Tests](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md)
131+
- [ ] (R) Production readiness review completed
132+
- [ ] (R) Production readiness review approved
133+
- [ ] "Implementation History" section is up-to-date for milestone
134+
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
135+
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
136+
137+
<!--
138+
**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone.
139+
-->
140+
141+
[kubernetes.io]: https://kubernetes.io/
142+
[kubernetes/enhancements]: https://git.k8s.io/enhancements
143+
[kubernetes/kubernetes]: https://git.k8s.io/kubernetes
144+
[kubernetes/website]: https://git.k8s.io/website
145+
146+
## Summary
147+
148+
From the Kubernetes release where this change is introduced, and onwards, beta APIs will not be enabled in clusters by default.
149+
Existing beta APIs and new versions of existing beta APIs, will continue to be enabled by default:
150+
if v1beta.some.group is currently enabled by default and we create v1beta2.some.group, v1beta2.some.group will still be enabled by default.
151+
152+
## Motivation
153+
154+
Beta APIs are not considered stable and reliance upon APIs in this state leads to exposure to bugs,
155+
guaranteed migration pain for users when the APIs move to stable, and the risk that dependencies will
156+
grow around unfinished APIs.
157+
Enabling beta APIs by default, exacerbates these problems by making them on in nearly every cluster.
158+
We observed these problems as we removed long-standing beta APIs and the PRR survey tells us that over
159+
90% of cluster-admins leave production clusters with these APIs enabled.
160+
Unsuitability for production use is documented at https://kubernetes.io/docs/reference/using-api/#api-versioning
161+
("The software is not recommended for production uses"), but defaulting on means they are present in nearly every
162+
production cluster.
163+
By disabling beta APIs by default, a cluster-admin can opt-in for specific APIs without having every
164+
incomplete API present in the cluster.
165+
This is now practical to do since conformance no longer relies on non-stable APIs.
166+
167+
### Goals
168+
169+
1. Disable new beta APIs by default.
170+
2. Continue enabling existing beta APIs and new version of existing beta APIs by default:
171+
if v1beta.some.group is currently enabled by default and we create v1beta2.some.group, v1beta2.some.group will still be enabled by default.
172+
3. Allow enabling specific resources in beta. Enable coolnewjobtype.v1beta1.batch.k8s.io without enabling other-neat-job.v1beta1.batch.k8s.io
173+
174+
### Non-Goals
175+
176+
1. Change feature gate defaults.
177+
Feature gates control new features (not just new APIs) and they are on by default for beta features.
178+
This KEP is not changing the lifecycle flow for feature gates.
179+
It is currently alpha=off-by-default, beta=on-by-default, stable=locked-to-on.
180+
181+
## Proposal
182+
183+
New beta APIs will be placed into the `DisableVersions` stanza instead of the `EnableVersions` stanza (see [DefaultAPIResourceConfigSource](https://github.com/kubernetes/kubernetes/blob/0669da445fa8c1ae07c15c0827f0e83da11cbe58/pkg/controlplane/instance.go#L643)).
184+
The `--runtime-config` flag will be extended to allow `group/version/resource=true`, to enable specific resources.
185+
To enable a beta API, a cluster-admin will have to add the appropriate `--runtime-config` flags.
186+
187+
### User Stories (Optional)
188+
189+
#### Story 1
190+
191+
As a cluster-admin I want to enable the coolnewjobtype.v1beta1.batch.k8s.io API in my cluster.
192+
193+
To do this I call `kube-apiserver --runtime-config=batch.k8s.io/v1beta1/coolnewjobtype`.
194+
195+
#### Story 2
196+
197+
As a cluster-admin I want to enable all beta APIs as in past releases.
198+
199+
To do this I call `kube-apiserver --runtime-config=api/beta=true`.
200+
This already exists and will continue to function.
201+
202+
203+
### Notes/Constraints/Caveats (Optional)
204+
205+
Installers, utilities, controllers, etc that need to know if a certain beta API is present can continue to use the
206+
existing discovery mechanisms (example: kubectl's api-resources sub command or the `/api/apps/v1` REST API).
207+
208+
### Risks and Mitigations
209+
210+
Adoption of beta features will slow.
211+
Given how kubernetes is now treated, this is a good thing, not a bad thing.
212+
Those users that want to move quickly and get new features can do so by enabling all beta feature
213+
or just enabling those that are important for their workload.
214+
The [PRR survey](https://datastudio.google.com/reporting/2e9c7439-202b-48a9-8c57-4459e0d69c8d/page/Cv5HB) shows that
215+
over 30% of cluster-admins have enabled alpha features on at least some production clusters, so cluster-admins are willing and able to enable features
216+
that are not on by default when they are desired.
217+
218+
If two or more APIs are tightly coupled together, it will now be possible to enable them independently.
219+
This can lead to unanticipated failure modes, but should only impact beta APIs with beta dependencies.
220+
While this is a risk, it is not very common and components should fail safe as a general principle.
221+
222+
If beta APIs are off by default, it's possible that fewer clients will use them and provide feedback.
223+
This is a risk, but early adopters are able to enable these features and have a history of enabling alpha features.
224+
When moving from beta to GA, it will be important for sigs to explicitly seek feedback.
225+
We will address this by extending the PRR questionnaire to include a GA-targeted question to validate that the feature
226+
was reasonably validated in production use-cases.
227+
228+
If beta APIs are off by default, it is possible that sigs don't treat taking an API as an indication of a "mostly-baked" API.
229+
If this happens, then more transformation may be required.
230+
Keeping our beta API rules consistent and continuing to enforce easy to use APIs seems to be the best option.
231+
232+
## Design Details
233+
234+
<!--
235+
This section should contain enough information that the specifics of your
236+
change are understandable. This may include API specs (though not always
237+
required) or even code snippets. If there's any ambiguity about HOW your
238+
proposal will be implemented, this is the place to discuss them.
239+
-->
240+
241+
### Test Plan
242+
243+
Integration tests will be written to ensure that no new beta APIs are enabled in the kube-apiserver by default.
244+
Unit tests will be written to ensure that the new flag functionality works as expected.
245+
246+
### Graduation Criteria
247+
248+
This KEP is a policy KEP, not a feature KEP. It will start as GA.
249+
250+
#### GA
251+
252+
- Integration and unit tests from above.
253+
- updating the enablement docs for beta
254+
- https://kubernetes.io/docs/reference/using-api/#api-versioning
255+
- https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#using-a-feature
256+
Even though that is talking about feature gates, it is likely worth calling out there that new beta REST APIs are no
257+
longer enabled by default)
258+
- email to [email protected] to explain the new policy
259+
- blog post explaining change in time for 1.24 release
260+
- CI configuration updated to have a testing mode that enables beta APIs, likely set using `kube-apiserver --runtime-config=api/beta=true`
261+
- extend the PRR questionnaire to include a GA-targeted question to validate that the feature was reasonably validated in production use-cases.
262+
263+
### Upgrade / Downgrade Strategy
264+
265+
The additional command line flag format for `--runtime-config` will not be recognized on older levels of kubernetes.
266+
This means that when downgrading, cluster-admins will have to adjust their CLI arguments if they opted into a new beta API.
267+
This is congruent to flag handling for new features today.
268+
Because this only impacts new beta APIs, there is no behavior change for existing APIs on upgrade.
269+
270+
### Version Skew Strategy
271+
272+
Because this only impacts new beta APIs, there is no novel skew risk.
273+
274+
## Production Readiness Review Questionnaire
275+
276+
Not applicable because this is a policy KEP.
277+
278+
## Implementation History
279+
280+
<!--
281+
Major milestones in the lifecycle of a KEP should be tracked in this section.
282+
Major milestones might include:
283+
- the `Summary` and `Motivation` sections being merged, signaling SIG acceptance
284+
- the `Proposal` section being merged, signaling agreement on a proposed design
285+
- the date implementation started
286+
- the first Kubernetes release where an initial version of the KEP was available
287+
- the version of Kubernetes where the KEP graduated to general availability
288+
- when the KEP was retired or superseded
289+
-->
290+
291+
## Drawbacks
292+
293+
<!--
294+
Why should this KEP _not_ be implemented?
295+
-->
296+
297+
## Alternatives
298+
299+
<!--
300+
What other approaches did you consider, and why did you rule them out? These do
301+
not need to be as detailed as the proposal, but should include enough
302+
information to express the idea and why it was not acceptable.
303+
-->
304+
305+
## Infrastructure Needed (Optional)
306+
307+
<!--
308+
Use this section if you need things from the project/SIG. Examples include a
309+
new subproject, repos requested, or GitHub details. Listing these here allows a
310+
SIG to get the process for these resources started right away.
311+
-->
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
title: Beta APIs Are Off by Default
2+
kep-number: 3136
3+
authors:
4+
- "@deads2k"
5+
owning-sig: sig-architecture
6+
participating-sigs:
7+
- sig-api-machinery
8+
status: implementable
9+
creation-date: 2022-01-13
10+
reviewers:
11+
approvers:
12+
- "@liggitt"
13+
- "@johnbelamaric"
14+
- "@derekwaynecarr"
15+
- "@dims"
16+
17+
##### WARNING !!! ######
18+
# prr-approvers has been moved to its own location
19+
# You should create your own in keps/prod-readiness
20+
# Please make a copy of keps/prod-readiness/template/nnnn.yaml
21+
# to keps/prod-readiness/sig-xxxxx/00000.yaml (replace with kep number)
22+
#prr-approvers:
23+
24+
see-also:
25+
- "/keps/sig-architecture/1635-prevent-permabeta"
26+
replaces:
27+
28+
# The target maturity stage in the current dev cycle for this KEP.
29+
stage: stable
30+
31+
# The most recent milestone for which work toward delivery of this KEP has been
32+
# done. This can be the current (upcoming) milestone, if it is being actively
33+
# worked on.
34+
latest-milestone: "v1.24"
35+
36+
# The milestone at which this feature was, or is targeted to be, at each stage.
37+
milestone:
38+
stable: "v1.24"
39+
40+
# The following PRR answers are required at alpha release
41+
# List the feature gate name and the components for which it must be enabled
42+
feature-gates:
43+
disable-supported: false
44+
45+
# The following PRR answers are required at beta release
46+
metrics:

0 commit comments

Comments
 (0)