-
Notifications
You must be signed in to change notification settings - Fork 1.6k
KEP-3104: Add kubectl kuberc command section #5572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -92,6 +92,18 @@ tags, and then generate with `hack/update-toc.sh`. | |||||
| - [Open Questions](#open-questions) | ||||||
| - [Risks and Mitigations](#risks-and-mitigations) | ||||||
| - [Design Details](#design-details) | ||||||
| - [Kubectl Kuberc Management Command (kubectl kuberc)](#kubectl-kuberc-management-command-kubectl-kuberc) | ||||||
| - [kubectl kuberc view](#kubectl-kuberc-view) | ||||||
| - [kubectl kuberc set --section defaults](#kubectl-kuberc-set---section-defaults) | ||||||
| - [command](#command) | ||||||
| - [option](#option) | ||||||
| - [overwrite](#overwrite) | ||||||
| - [kubectl kuberc set --section aliases](#kubectl-kuberc-set---section-aliases) | ||||||
| - [name](#name) | ||||||
| - [command](#command-1) | ||||||
| - [option](#option-1) | ||||||
| - [prependarg](#prependarg) | ||||||
| - [appendarg](#appendarg) | ||||||
| - [Test Plan](#test-plan) | ||||||
| - [Prerequisite testing updates](#prerequisite-testing-updates) | ||||||
| - [Unit tests](#unit-tests) | ||||||
|
|
@@ -358,6 +370,83 @@ defaults: | |||||
|
|
||||||
| ``` | ||||||
|
|
||||||
| ### Kubectl Kuberc Management Command (kubectl kuberc) | ||||||
|
|
||||||
| In alpha (and initially in beta), users are expected to generate their kuberc files manually. However, this operation is error-prone and cumbersome. | ||||||
| The lack of kubectl command which operates on kuberc file makes the adoption of this feature significantly difficult. | ||||||
| Therefore, this section proposes new kubectl command, namely `kubectl kuberc`. | ||||||
|
|
||||||
| `kubectl kuberc` is the main command serving as an entry point to the subcommands similar to how `kubectl create` is designed. | ||||||
| Invocation of `kubectl kuberc` prints the subcommands. | ||||||
| Currently, there are two subcommands (but this can be extended in the future, when more functionality is added to kuberc). | ||||||
| All the subcommands accept `kuberc` flag to explicitly specify the kuberc file to be updated. File priority order is the same with | ||||||
| kuberc execution: | ||||||
|
|
||||||
| * If `--kuberc` flag is specified, operate on this file | ||||||
| * If `KUBERC` environment variable is specified, operate on this file | ||||||
| * If none, operate on default kuberc (i.e. `$HOME/.kube/kuberc`). | ||||||
|
|
||||||
| This command and subcommands are marked as alpha initially. They can be executed under `kubectl alpha`, until they are promoted to beta. | ||||||
|
|
||||||
| ### kubectl kuberc view | ||||||
|
|
||||||
| `kubectl kuberc view` subcommand prints the defined kuberc file content in the given format via `--output` flag (default is yaml). | ||||||
|
|
||||||
| ### kubectl kuberc set --section defaults | ||||||
|
|
||||||
| `kubectl kuberc set --section defaults` subcommand creates/updates the default values of commands. It has the following flags; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| #### command | ||||||
|
|
||||||
| `kubectl kuberc set --section defaults` command validates the presence of the command given via flag `--command`. | ||||||
| This flag can contain subcommands as well. Examples might be `--command=apply`, `--command="create role"`. | ||||||
|
|
||||||
| #### option | ||||||
|
|
||||||
| `--option` flag accepts list of options. We may or may not validate the presence of the flag name in the given command. | ||||||
| But it is up to user to set the correct default value in correct type. Therefore, default field of the options is arbitrary. | ||||||
| Examples might be `--option="server-side=true"`, `--option="namespace=test"`. | ||||||
|
|
||||||
| Although kuberc supports short versions of flags (e.g. `-n test`), | ||||||
| this flag forces users to enter options in standardized format `--option=$flag_name=$flag_value`. | ||||||
| This gives us the opportunity to standardize kuberc files. | ||||||
|
|
||||||
| #### overwrite | ||||||
|
|
||||||
| By default, this command errors out, if it finds a section of same command and same flag that is executed. `--overwrite` flag | ||||||
| is used to update this section. | ||||||
|
|
||||||
| ### kubectl kuberc set --section aliases | ||||||
|
|
||||||
| `kubectl kuberc set --section aliases` defines alias definitions of a command and a set of flag options. It has these flags; | ||||||
|
|
||||||
| #### name | ||||||
|
|
||||||
| This required field is to define the name of the alias. This is inherently arbitrary field based on the preferences of the user. | ||||||
|
|
||||||
| #### command | ||||||
|
|
||||||
| `kubectl kuberc set --section aliases` command validates the presence of the command given via flag `--command`. | ||||||
| This flag can contain subcommands as well. Examples might be `--command=apply`, `--command="create role"`. | ||||||
|
|
||||||
| #### option | ||||||
|
|
||||||
| `--option` flag accepts list of options. We may or may not validate the presence of the flag name in the given command. | ||||||
| But it is up to user setting the correct default value in correct type. Therefore, default field of the options is arbitrary. | ||||||
| Examples might be `--option="server-side=true"`, `--option="namespace=test"`. | ||||||
|
|
||||||
| Although kuberc supports short versions of flags (e.g. `-n test`), | ||||||
| this flag forces users to enter options in opinionated format `--option=$flag_name=$flag_value`. | ||||||
| This gives us the opportunity to standardize kuberc files. | ||||||
|
|
||||||
| #### prependarg | ||||||
|
|
||||||
| `--prependarg` is an arbitrary list of strings that accepts anything in a string array format. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| #### appendarg | ||||||
|
|
||||||
| `--appendarg` is an arbitrary list of strings that accepts anything in string array format. | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### Test Plan | ||||||
|
|
||||||
| <!-- | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.