-
Notifications
You must be signed in to change notification settings - Fork 485
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
Krew plugin criteria #152
Closed
corneliusweig
wants to merge
9
commits into
kubernetes-sigs:master
from
corneliusweig:plugin-criteria
Closed
Krew plugin criteria #152
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bc1ecdf
Add draft for plugin criteria
corneliusweig 3b9398f
Format rules in a table
corneliusweig 5b22912
Improve the krew-index rationale
corneliusweig 18f8db6
Format tables as html tables instead of markdown
corneliusweig 33f6f87
Elaborate on the examples, put them in lists
corneliusweig 4988606
Replace backticks with <code> tags
corneliusweig 25793a2
Revise plugin acceptance criteria
corneliusweig 345dba3
Alleviate usability requirements to guidelines
corneliusweig 1d6e653
Add recommendation to use genericclioptions
corneliusweig 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 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 |
---|---|---|
@@ -0,0 +1,135 @@ | ||
Krew plugin criteria | ||
=== | ||
|
||
Rationale | ||
--- | ||
|
||
Krew is a `kubectl` plugin manager. | ||
|
||
The centralized Krew plugin index (`sigs.k8s.io/krew-index` repository) holds plugins that are applicable to a broad set of kubectl users. | ||
|
||
A plugin in the Krew plugin index must add new functionality or enhance the existing functionality in `kubectl`, or encapsulate a common operator/developer workflow for higher productivity. | ||
|
||
A plugin should be classified in the following categories: | ||
|
||
- Purpose | ||
- Category | ||
- Usability | ||
|
||
Purpose | ||
--- | ||
|
||
This task should be classified in one of the categories: | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Classification</th> | ||
<th>Recommendation</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1.</td> | ||
<td>The task is already solved by kubectl.</td> | ||
<td> | ||
Mere command wrappers are not acceptable, as those are better coveredby shell aliases. | ||
However, convenience and productivity improvements are welcome. Examples: | ||
<ul> | ||
<li><code>konfig</code> is a convencience script to aid with merging of kubeconfig files, similar to <code>kubectl config view</code>.</li> | ||
<li><code>change-ns</code> is a utility easily switch between namespaces, similar to <code>kubectl config set-context --curent -n</code></li> | ||
<li><code>view-secret</code> retrieves and decodes secrets, similar to <code>kubectl get secret -o jsonpath=... | base64 -d</code></li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>2.</td> | ||
<td> | ||
The task provides a different solution to a problem which is also solved by kubectl. | ||
However, the task would be impossible or very hard to reproduce with kubectl alone. | ||
</td> | ||
<td> | ||
In general welcome unless it overlaps significantly with other plugins or has a bad usability. | ||
Examples: | ||
<ul> | ||
<li><code>get-all</code> plugin is a replacement for <code>kubectl get all</code> command which actually fetches only a subset of API resource types.</li> | ||
<li><code>access-matrix</code> gives an overview of authorities, whereas <code>kubectl auth can-i</code> only applies to single resource/verb pairs</li> | ||
<li><code>tail</code> plugin allows tailing logs from pods from a label selector, a namespace or all namespaces at once, whereas <code>kubectl logs</code> command has more limited functionality.</li> | ||
<li><code>mtail</code> plugin allows tailing logs from pods from a label selector, similar to <code>kubectl logs -l</code> but labels log lines.</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>3.</td> | ||
<td>The task addresses a completely different problem than any of the kubectl subcommands, but is clearly focused on k8s.</td> | ||
<td> | ||
Gray area. If most users would use tool as a <code>kubectl</code> plugin, it may be accepted. | ||
For example, <code>kubectl debug-pod</code> would be acceptable. | ||
On the other hand, <code>helm</code> as <code>kubectl helm</code> would not be acceptable, because it is independent. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>4.</td> | ||
<td> | ||
The task is very dissimilar to common kubectl tasks and is not primarily focused on k8s. | ||
However, it can be useful in the k8s ecosystem. | ||
</td> | ||
<td>Not acceptable. Consider distributing as a separate tool instead of making it a kubectl plugin.</td> | ||
</tr> | ||
<tr> | ||
<td>5.</td> | ||
<td> | ||
The task is very dissimilar to common kubectl tasks and is not focused on k8s. | ||
Its general usefulness in the k8s ecosystem is questionable. | ||
</td> | ||
<td>Not acceptable.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
Category | ||
--- | ||
|
||
In order of decreasing usage frequency: | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Classification</th> | ||
<th>Recommendation</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>1.</td> | ||
<td>Recurring task on the same cluster. For example: <code>mtail</code></td> | ||
<td>Favors acceptance as plugin.</td> | ||
</tr> | ||
<tr> | ||
<td>2.</td> | ||
<td> | ||
Recurring task on different cluster instances, but one-time task on the same cluster instance. | ||
For example: <code>init-tiller</code> | ||
</td> | ||
<td>Gray area. Usually this is not acceptable.</td> | ||
</tr> | ||
<tr> | ||
<td>3.</td> | ||
<td>One-time task per machine.</td> | ||
<td>In general not acceptable as plugin.</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
Usability | ||
--- | ||
Plugins should be as user-friendly as possible. | ||
Please follow the following guidelines: | ||
|
||
1. Standard look & feel: The plugin should adhere to standard kubectl best practices and have consistent (abbreviated) flag names. For example: bad `--ns`, good `--namespace` + `-n`. | ||
- when writing a plugin in go, consider using the official `k8s.io/cli-runtime/pkg/genericclioptions` | ||
2. A plugin should be documented in such a way, that a proficient `kubectl` user immediately understands its purpose and how to use it. | ||
3. If the plugin has dependencies, try to limit those to fundamental UNIX tools (like bash, sed, grep, awk) or popular tools (like jq, yq) as this makes it easier to get started. | ||
4. Make sure the plugin fails with a user-friendly error when a required dependency is missing. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an indicator of this is:
If this is the case, then it's probably more suitable. e.g. in case of
helm
vskubectl helm
, there's no need to make it a plugin, because it doesn't add anything to kubectl.Worth adding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added that to the recommendation column. Was that what you intended?