Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions keps/sig-cli/3104-introduce-kuberc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`kubectl kuberc set --section defaults` subcommand creates/updates the default values of commands. It has the following flags;
`kubectl kuberc set --section defaults` subcommand creates/updates the default values of commands. It has the following flags:


#### 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`--prependarg` is an arbitrary list of strings that accepts anything in a string array format.
`--prependarg` is an arbitrary list of strings that accept anything in a string array format.


#### appendarg

`--appendarg` is an arbitrary list of strings that accepts anything in string array format.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`--appendarg` is an arbitrary list of strings that accepts anything in string array format.
`--appendarg` is an arbitrary list of strings that accept anything in string array format.


### Test Plan

<!--
Expand Down
2 changes: 1 addition & 1 deletion keps/sig-cli/3104-introduce-kuberc/kep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ stage: beta
# 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.34"
latest-milestone: "v1.35"

# The milestone at which this feature was, or is targeted to be, at each stage.
milestone:
Expand Down