diff --git a/keps/prod-readiness/sig-cli/3104.yaml b/keps/prod-readiness/sig-cli/3104.yaml new file mode 100644 index 00000000000..8cc2fc82c2f --- /dev/null +++ b/keps/prod-readiness/sig-cli/3104.yaml @@ -0,0 +1,3 @@ +kep-number: 3104 +alpha: + approver: "@johnbelamaric" diff --git a/keps/sig-cli/3104-introduce-kuberc/README.md b/keps/sig-cli/3104-introduce-kuberc/README.md new file mode 100644 index 00000000000..ad30394aba0 --- /dev/null +++ b/keps/sig-cli/3104-introduce-kuberc/README.md @@ -0,0 +1,926 @@ + +# KEP-3104: Introduce kuberc + + + + + + +- [Release Signoff Checklist](#release-signoff-checklist) +- [Summary](#summary) +- [Motivation](#motivation) + - [Goals](#goals) + - [Non-Goals](#non-goals) +- [Proposal](#proposal) + - [User Stories (Optional)](#user-stories-optional) + - [Story 1](#story-1) + - [Story 2](#story-2) + - [Story 3](#story-3) + - [Notes/Constraints/Caveats (Optional)](#notesconstraintscaveats-optional) + - [Open Questions](#open-questions) + - [Risks and Mitigations](#risks-and-mitigations) +- [Design Details](#design-details) + - [Test Plan](#test-plan) + - [Prerequisite testing updates](#prerequisite-testing-updates) + - [Unit tests](#unit-tests) + - [Integration tests](#integration-tests) + - [e2e tests](#e2e-tests) + - [Graduation Criteria](#graduation-criteria) + - [Alpha](#alpha) + - [Beta](#beta) + - [GA](#ga) + - [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy) + - [Version Skew Strategy](#version-skew-strategy) +- [Production Readiness Review Questionnaire](#production-readiness-review-questionnaire) + - [Feature Enablement and Rollback](#feature-enablement-and-rollback) + - [Rollout, Upgrade and Rollback Planning](#rollout-upgrade-and-rollback-planning) + - [Monitoring Requirements](#monitoring-requirements) + - [Dependencies](#dependencies) + - [Scalability](#scalability) + - [Troubleshooting](#troubleshooting) +- [Implementation History](#implementation-history) +- [Drawbacks](#drawbacks) +- [Alternatives](#alternatives) +- [Infrastructure Needed (Optional)](#infrastructure-needed-optional) + + +## Release Signoff Checklist + + + +Items marked with (R) are required *prior to targeting to a milestone / release*. + +- [x] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR) +- [x] (R) KEP approvers have approved the KEP status as `implementable` +- [x] (R) Design details are appropriately documented +- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input (including test refactors) + - [ ] e2e Tests for all Beta API Operations (endpoints) + - [ ] (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) + - [ ] (R) Minimum Two Week Window for GA e2e tests to prove flake free +- [ ] (R) Graduation criteria is in place + - [ ] (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) +- [ ] (R) Production readiness review completed +- [ ] (R) Production readiness review approved +- [ ] "Implementation History" section is up-to-date for milestone +- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io] +- [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes + + + +[kubernetes.io]: https://kubernetes.io/ +[kubernetes/enhancements]: https://git.k8s.io/enhancements +[kubernetes/kubernetes]: https://git.k8s.io/kubernetes +[kubernetes/website]: https://git.k8s.io/website + +## Summary + + + +This proposal introduces an optional `kuberc` file that is used to separate cluster credentials and server configuration from user preferences. + +## Motivation + + +kubectl is one of the oldest parts of the Kubernetes project and has a strong guarantee on backwards compatibility. We want users to be able to opt in to new behaviors (like delete confirmation) that may be considered breaking changes for existing CI jobs and scripts. + +[kubeconfigs already have a field for preferences](https://github.com/kubernetes/kubernetes/blob/474fd40e38bc4e7f968f7f6dbb741b7783b0740b/staging/src/k8s.io/client-go/tools/clientcmd/api/types.go#L43) that is currently underutilized. The reason for not using this existing field is that creating a new cluster generally yields a new kubeconfig file which contains credentials and host information. While kubeconfigs can be merged and specified by path, we feel there should be a clear separation between server configuration and user preferences. + +### Goals + + + +* Introduce a `kuberc` file as a place for client preferences. +* Version and structure this file in a way that makes it easy to introduce new behaviors and settings for users. +* Enable users to define kubectl command aliases. +* Enable users to define kubectl default flags. +* Deprecate [kubeconfig `Preferences` field](https://github.com/kubernetes/kubernetes/blob/4b024fc4eeb4a3eeb831e7fddec52b83d0b072df/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/types.go#L40). + +### Non-Goals + + + +## Proposal + + + +We propose introducing a new file that will be versioned and intended for user provided preferences. This new file is entirely opt-in. + +### User Stories (Optional) + + + +#### Story 1 + +As a user I would like to specify preferences per client (device) without my kubeconfig overriding them when I access different clusters. + +#### Story 2 + +As a user I would like to opt in to enforcing delete confirmation or colored output on my local client but not disrupt my CI pipeline with unexpected prompts or output. + +https://groups.google.com/g/kubernetes-dev/c/y4Q20V3dyOk + +https://github.com/kubernetes/kubectl/issues/524 + +#### Story 3 + +[UNRESOLVED] As a user I would like to use different preferences per context. + +### Notes/Constraints/Caveats (Optional) + + + +#### Open Questions + +1. [How are subcommands indicated for command overrides?](https://github.com/kubernetes/enhancements/pull/3392#discussion_r896174406) +1. [How are subcommand aliases indicated?](https://github.com/kubernetes/enhancements/pull/3392#discussion_r896179267) +1. [How do we handle tying these settings to cluster contexts?](https://github.com/kubernetes/enhancements/pull/3392#discussion_r898239057) +1. [Do we want this file to live elsewhere i.e. XDG_CONFIG?](https://github.com/kubernetes/enhancements/pull/3392#discussion_r896177353) +1. [How do we exectue subcommands and do we want to support variable substitution i.e. `$1`](https://github.com/kubernetes/enhancements/pull/3392#discussion_r898227148) + +### Risks and Mitigations + + + +| Risk | Impact | Mitigation | +| --- | --- | --- | +| Confusing users with a new config file | Low | Documentation and education | + +## Design Details + + + +During alpha this feature will be enabled through the `ENABLE_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`. + +Three initial top level keys are proposed. + +* `apiVersion` to determine the version of the config. +* `kind` to keep consistency with Kubernetes resources. +* `command` + * `aliases` for users to declare their own aliases for commands with flags and values. + * `overrides` for users to set default flags to apply to commands. + +`command.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. + +`command.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. + +``` +apiVersion: v1alpha1 +kind: Preferences + +command: + aliases: + - alias: getdbprod + command: get pods -l what=database --namespace us-2-production + + overrides: + - command: apply + flags: + - name: server-side + default: "true" + - command: delete + flags: + - name: confirm + default: "true" + - command: "*" + flags: + - name: exec-auth-allowlist + default: /var/kubectl/exec/... + +``` + +### Test Plan + + + +[x] I/we understand the owners of the involved components may require updates to +existing tests to make this code solid enough prior to committing the changes necessary +to implement this enhancement. + +##### Prerequisite testing updates + + + +Aside from standard testing we will also be skew testing. + +##### Unit tests + + + + + +- ``: `` - `` + +##### Integration tests + + + +- : + +##### e2e tests + + + +- : + +### Graduation Criteria + + + +#### Alpha + +- Initial implementation behind environment variable. + +#### Beta + +- Gather feedback from developers and shape API appropriately. +- Decide if we want to do support configs per context. + +#### GA + +- Allowing time for feedback. + + +### Upgrade / Downgrade Strategy + + + +### Version Skew Strategy + + + +This feature will follow the [version skew policy of kubectl](https://kubernetes.io/releases/version-skew-policy/#kubectl). + +## Production Readiness Review Questionnaire + + + +### Feature Enablement and Rollback + + + +###### How can this feature be enabled / disabled in a live cluster? + + + +- [ ] Feature gate (also fill in values in `kep.yaml`) + - Feature gate name: + - Components depending on the feature gate: +- [x] Other + - Describe the mechanism: The environment variable `ENABLE_KUBERC=true`. + - Will enabling / disabling the feature require downtime of the control + plane? No. + - Will enabling / disabling the feature require downtime or reprovisioning + of a node? (Do not assume `Dynamic Kubelet Config` feature is enabled). No. + +###### Does enabling the feature change any default behavior? + + + +No. + +###### Can the feature be disabled once it has been enabled (i.e. can we roll back the enablement)? + + + +Yes the environment variable can be unset and `~/.kube/kuberc` can be removed. + +###### What happens if we reenable the feature if it was previously rolled back? + +The new feature is enabled. + +###### Are there any tests for feature enablement/disablement? + + + +Yes there will be. + +### Rollout, Upgrade and Rollback Planning + + + +###### How can a rollout or rollback fail? Can it impact already running workloads? + + + +Not applicable. + +###### What specific metrics should inform a rollback? + + + +Not applicable. + +###### Were upgrade and rollback tested? Was the upgrade->downgrade->upgrade path tested? + + + +Not applicable. + +###### Is the rollout accompanied by any deprecations and/or removals of features, APIs, fields of API types, flags, etc.? + + + +Not applicable. + +### Monitoring Requirements + + + +###### How can an operator determine if the feature is in use by workloads? + + + +Not applicable. + +###### How can someone using this feature know that it is working for their instance? + + + +- [ ] Events + - Event Reason: +- [ ] API .status + - Condition name: + - Other field: +- [x] Other (treat as last resort) + - Details: The command will be logged with kubectl -v 2 + +###### What are the reasonable SLOs (Service Level Objectives) for the enhancement? + + + +Not applicable. + +###### What are the SLIs (Service Level Indicators) an operator can use to determine the health of the service? + + + +- [ ] Metrics + - Metric name: + - [Optional] Aggregation method: + - Components exposing the metric: +- [ ] Other (treat as last resort) + - Details: + - +Not applicable. + +###### Are there any missing metrics that would be useful to have to improve observability of this feature? + + + +### Dependencies + + + +###### Does this feature depend on any specific services running in the cluster? + + + +Not applicable. + +### Scalability + + + +###### Will enabling / using this feature result in any new API calls? + + + +No. + +###### Will enabling / using this feature result in introducing new API types? + + + +There will be a new type similar to a kubeconfig - not in the API server. + +###### Will enabling / using this feature result in any new calls to the cloud provider? + + + +No. + +###### Will enabling / using this feature result in increasing size or count of the existing API objects? + + + +No. + +###### Will enabling / using this feature result in increasing time taken by any operations covered by existing SLIs/SLOs? + + + +No. + +###### Will enabling / using this feature result in non-negligible increase of resource usage (CPU, RAM, disk, IO, ...) in any components? + + + +No. + +### Troubleshooting + + + +###### How does this feature react if the API server and/or etcd is unavailable? + +###### What are other known failure modes? + + + +###### What steps should be taken if SLOs are not being met to determine the problem? + +## Implementation History + + + +* 2021-06-02: [Proposal to add delete confirmation](https://github.com/kubernetes/enhancements/issues/2775) +* 2022-06-13: This KEP created. + +## Drawbacks + + + +## Alternatives + + + +## Infrastructure Needed (Optional) + + diff --git a/keps/sig-cli/3104-introduce-kuberc/kep.yaml b/keps/sig-cli/3104-introduce-kuberc/kep.yaml new file mode 100644 index 00000000000..48e09704e95 --- /dev/null +++ b/keps/sig-cli/3104-introduce-kuberc/kep.yaml @@ -0,0 +1,47 @@ +title: Introduce kuberc +kep-number: 3104 +authors: + - "@eddiezane" +owning-sig: sig-cli +participating-sigs: + - sig-cli +status: implementable +creation-date: 2022-06-13 +reviewers: + - "@soltysh" + - "@liggitt" +approvers: + - "@soltysh" + +##### WARNING !!! ###### +# prr-approvers has been moved to its own location +# You should create your own in keps/prod-readiness +# Please make a copy of keps/prod-readiness/template/nnnn.yaml +# to keps/prod-readiness/sig-xxxxx/00000.yaml (replace with kep number) +#prr-approvers: + +see-also: + - https://github.com/kubernetes/enhancements/issues/2775 +replaces: [] + +# The target maturity stage in the current dev cycle for this KEP. +stage: alpha + +# The most recent milestone for which work toward delivery of this KEP has been +# done. This can be the current (upcoming) milestone, if it is being actively +# worked on. +latest-milestone: "v1.25" + +# The milestone at which this feature was, or is targeted to be, at each stage. +milestone: + alpha: "v1.25" + beta: "v1.27" + stable: "v1.28" + +# The following PRR answers are required at alpha release +# List the feature gate name and the components for which it must be enabled +feature-gates: [] +disable-supported: true + +# The following PRR answers are required at beta release +metrics: []