Skip to content

Commit 3e98d86

Browse files
authored
Merge pull request #5300 from soltysh/kuberc_beta
KEP-3104: promote kuberc to beta
2 parents 9f7f291 + 2546dc6 commit 3e98d86

File tree

3 files changed

+79
-42
lines changed

3 files changed

+79
-42
lines changed

keps/prod-readiness/sig-cli/3104.yaml

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

keps/sig-cli/3104-introduce-kuberc/README.md

Lines changed: 74 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ Items marked with (R) are required *prior to targeting to a milestone / release*
137137
- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR)
138138
- [x] (R) KEP approvers have approved the KEP status as `implementable`
139139
- [x] (R) Design details are appropriately documented
140-
- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
141-
- [ ] e2e Tests for all Beta API Operations (endpoints)
140+
- [x] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors)
141+
- [x] e2e Tests for all Beta API Operations (endpoints)
142142
- [ ] (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)
143143
- [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free
144-
- [ ] (R) Graduation criteria is in place
145-
- [ ] (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)
144+
- [x] (R) Graduation criteria is in place
145+
- [x] (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)
146146
- [x] (R) Production readiness review completed
147147
- [x] (R) Production readiness review approved
148148
- [x] "Implementation History" section is up-to-date for milestone
149-
- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
150-
- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
149+
- [x] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
150+
- [x] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
151151

152152
<!--
153153
**Note:** This checklist is iterative and should be reviewed and updated every time this enhancement is being considered for a milestone.
@@ -207,7 +207,7 @@ know that this has succeeded?
207207
* Introduce a `kuberc` file as a place for client preferences.
208208
* Version and structure this file in a way that makes it easy to introduce new behaviors and settings for users.
209209
* Enable users to define kubectl command aliases.
210-
* Enable users to define kubectl default flags.
210+
* Enable users to define kubectl default options.
211211
* Deprecate [kubeconfig `Preferences` field](https://github.com/kubernetes/kubernetes/blob/4b024fc4eeb4a3eeb831e7fddec52b83d0b072df/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/types.go#L40).
212212

213213
### Non-Goals
@@ -305,41 +305,54 @@ required) or even code snippets. If there's any ambiguity about HOW your
305305
proposal will be implemented, this is the place to discuss them.
306306
-->
307307

308-
During alpha this feature will be enabled through the `KUBECTL_KUBERC=true` environment variable. The file will default to being located in `~/.kube/kuberc`. A flag will allow overriding this default location with a path i.e. `kubectl --kuberc /var/kube/rc`.
308+
For beta this feature will be enabled by default. However, users can disable it
309+
by setting the `KUBECTL_KUBERC` environment variable to `false`. Additionally,
310+
users can always set the `KUBERC` environment variable to `off`, which disables
311+
the preference mechanism at any point in time.
309312

310-
Three initial top level keys are proposed.
313+
By default, the configuration file will be located in `~/.kube/kuberc`. A flag
314+
will allow overriding this default location with a specific path, for example:
315+
`kubectl --kuberc /var/kube/rc`.
311316

312-
* `apiVersion` to determine the version of the config.
313-
* `kind` to keep consistency with Kubernetes resources.
314-
* `aliases` for users to declare their own aliases for commands with flags and values.
315-
* `overrides` for users to set default flags to apply to commands.
317+
The following top-level keys are proposed, alongside the kubernetes `metav1.TypeMeta`
318+
fields (`apiVersion`, `kind`):
316319

317-
`aliases` will not be allowed to override builtins but take precedence of plugins i.e. builtins -> aliases -> plugins. Additional flags and values will be appended to the end of the aliased command. It is the responsibility of the user to define aliases with this in mind.
320+
* `aliases` Allows users to declare their own command aliases, including options and values.
321+
* `defaults` Enables users to set default options to be applied to commands.
318322

319-
`overrides` is modeled after all configurable behavior being implemented as flags first. This is a design decision that was made after modeling out the intended behavior and realizing that targeting flags filled the use cases. A merge will be done in the execution of the command for flags with inline overrides taking precedence.
323+
`aliases` will not be permitted to override built-in commands but will take
324+
precedence over plugins (builtins -> aliases -> plugins). Any additional options
325+
and values will be appended to the end of the aliased command. Users are
326+
responsible for defining aliases with this behavior in mind.
327+
328+
`defaults` is designed based on the principle that all configurable behavior is
329+
initially implemented as options. This design decision was made after analyzing the
330+
intended behavior and realizing that targeting options effectively addresses the
331+
use cases. During command execution, a merge will be occur, with inline overrides
332+
taking precedence over the defaults.
320333

321334
```
322-
apiVersion: kubectl.config.k8s.io/v1alpha1
335+
apiVersion: kubectl.config.k8s.io/v1beta1
323336
kind: Preference
324337
325338
aliases:
326339
- name: getdbprod
327340
command: get
328341
prependArgs:
329342
- pods
330-
flags:
343+
options:
331344
- name: labels
332345
default: what=database
333346
- name: namespace
334347
default: us-2-production
335348
336-
overrides:
349+
defaults:
337350
- command: apply
338-
flags:
351+
options:
339352
- name: server-side
340353
default: "true"
341354
- command: delete
342-
flags:
355+
options:
343356
- name: interactive
344357
default: "true"
345358
@@ -369,7 +382,11 @@ Based on reviewers feedback describe what additional tests need to be added prio
369382
implementing this enhancement to ensure the enhancements have also solid foundations.
370383
-->
371384

372-
Aside from standard testing we will also be skew testing.
385+
We're planning to expand tests adding:
386+
- config API fuzzy tests
387+
- cross API config loading
388+
- input validation and correctness
389+
- simple e2e using kuberc
373390

374391
##### Unit tests
375392

@@ -395,10 +412,9 @@ extending the production code to implement this enhancement.
395412
396413
-->
397414

398-
We're planning unit tests covering:
399-
- basic functionality
400-
- config API fuzzy tests
401-
- input validation and correctness
415+
- `k8s.io/kubectl/pkg/cmd/`: `2025-05-13` - `57.0%`
416+
- `k8s.io/kubectl/pkg/config/`: `2025-05-13` - `0.0%`
417+
- `k8s.io/kubectl/pkg/kuberc/`: `2025-05-13` - `64.5%`
402418

403419
##### Integration tests
404420

@@ -413,9 +429,7 @@ https://storage.googleapis.com/k8s-triage/index.html
413429
414430
-->
415431

416-
We're planning at least the following integration tests:
417-
- `KUBECTL_KUBERC` enablement and disablement
418-
- basic functionality
432+
- [test-cmd.run_kuberc_tests](https://github.com/kubernetes/kubernetes/blob/fd15e3fd5566fb0a65ded1883fbf51ce7a68fe28/test/cmd/kuberc.sh): [integration cmd-master](https://testgrid.k8s.io/sig-release-master-blocking#cmd-master)
419433

420434
##### e2e tests
421435

@@ -470,13 +484,24 @@ Below are some examples to consider, in addition to the aforementioned [maturity
470484
- Gather feedback from developers and surveys
471485
- Complete features A, B, C
472486
- Additional tests are in Testgrid and linked in KEP
487+
- More rigorous forms of testing—e.g., downgrade tests and scalability tests
488+
- All functionality completed
489+
- All security enforcement completed
490+
- All monitoring requirements completed
491+
- All testing requirements completed
492+
- All known pre-release issues and gaps resolved
493+
494+
**Note:** Beta criteria must include all functional, security, monitoring, and testing requirements along with resolving all issues and gaps identified
473495
474496
#### GA
475497
476498
- N examples of real-world usage
477499
- N installs
478500
- More rigorous forms of testing—e.g., downgrade tests and scalability tests
479501
- Allowing time for feedback
502+
- All issues and gaps identified as feedback during beta are resolved
503+
504+
**Note:** GA criteria must not include any functional, security, monitoring, or testing requirements. Those must be beta requirements.
480505
481506
**Note:** Generally we also wait at least two releases between beta and
482507
GA/stable, because there's no opportunity for user feedback, or even bug reports,
@@ -540,6 +565,12 @@ enhancement:
540565

541566
This feature will follow the [version skew policy of kubectl](https://kubernetes.io/releases/version-skew-policy/#kubectl).
542567

568+
Furthermore, kubectl will be equipped with a mechanism which will allow it to
569+
read all past versions of the kuberc file, and pick the latest known one.
570+
This mechanism will ensure that users can continue using whatever version of
571+
kuberc they started with, unless they are interested in newer feature available
572+
only in newer releases.
573+
543574
## Production Readiness Review Questionnaire
544575

545576
<!--
@@ -635,7 +666,9 @@ You can take a look at one potential example of such test in:
635666
https://github.com/kubernetes/kubernetes/pull/97058/files#diff-7826f7adbc1996a05ab52e3f5f02429e94b68ce6bce0dc534d1be636154fded3R246-R282
636667
-->
637668

638-
Yes there will be.
669+
Yes, there is a [kuberc CLI test](https://github.com/kubernetes/kubernetes/blob/06c196438acb771d26ff983ff0f18a611acba208/test/cmd/kuberc.sh#L153-L156),
670+
which verifies that `--kuberc` is used when the `KUBECTL_KUBERC` is on, and is
671+
ignored when it's turned off.
639672

640673
### Rollout, Upgrade and Rollback Planning
641674

@@ -747,13 +780,6 @@ Not applicable.
747780
Pick one more of these and delete the rest.
748781
-->
749782

750-
- [ ] Metrics
751-
- Metric name:
752-
- [Optional] Aggregation method:
753-
- Components exposing the metric:
754-
- [ ] Other (treat as last resort)
755-
- Details:
756-
-
757783
Not applicable.
758784

759785
###### Are there any missing metrics that would be useful to have to improve observability of this feature?
@@ -905,6 +931,8 @@ details). For now, we leave it here.
905931

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

934+
`kubectl` is not resilient to API server unavailability.
935+
908936
###### What are other known failure modes?
909937

910938
<!--
@@ -920,8 +948,12 @@ For each of them, fill in the following information by copying the below templat
920948
- Testing: Are there any tests for failure mode? If not, describe why.
921949
-->
922950

951+
Not applicable.
952+
923953
###### What steps should be taken if SLOs are not being met to determine the problem?
924954

955+
Not applicable.
956+
925957
## Implementation History
926958

927959
<!--
@@ -938,12 +970,11 @@ Major milestones might include:
938970
* 2021-06-02: [Proposal to add delete confirmation](https://github.com/kubernetes/enhancements/issues/2775)
939971
* 2022-06-13: This KEP created.
940972
* 2024-06-07: Update KEP with new env var name and template.
973+
* 2025-05-13: Update KEP for beta promotion.
941974

942975
## Drawbacks
943976

944-
<!--
945-
Why should this KEP _not_ be implemented?
946-
-->
977+
None considered.
947978

948979
## Alternatives
949980

@@ -953,10 +984,14 @@ not need to be as detailed as the proposal, but should include enough
953984
information to express the idea and why it was not acceptable.
954985
-->
955986

987+
None considered.
988+
956989
## Infrastructure Needed (Optional)
957990

958991
<!--
959992
Use this section if you need things from the project/SIG. Examples include a
960993
new subproject, repos requested, or GitHub details. Listing these here allows a
961994
SIG to get the process for these resources started right away.
962995
-->
996+
997+
Not applicable.

keps/sig-cli/3104-introduce-kuberc/kep.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ see-also:
2121
replaces: []
2222

2323
# The target maturity stage in the current dev cycle for this KEP.
24-
stage: alpha
24+
stage: beta
2525

2626
# The most recent milestone for which work toward delivery of this KEP has been
2727
# done. This can be the current (upcoming) milestone, if it is being actively
2828
# worked on.
29-
latest-milestone: "v1.33"
29+
latest-milestone: "v1.34"
3030

3131
# The milestone at which this feature was, or is targeted to be, at each stage.
3232
milestone:
3333
alpha: "v1.33"
34-
beta: ""
34+
beta: "1.34"
3535
stable: ""
3636

3737
# The following PRR answers are required at alpha release

0 commit comments

Comments
 (0)