Skip to content

Commit 600d65d

Browse files
authored
docs: update TOCs (use markdown-toc), md lint (#120)
1 parent ae33c83 commit 600d65d

4 files changed

Lines changed: 37 additions & 24 deletions

File tree

docs/DEVELOPER_GUIDE.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ plugins, read the [User Guide](./USER_GUIDE.md) to learn how to use krew.
66
This guide explains how to package, test, run plugins locally and make them
77
available on the krew index.
88

9-
<!-- TOC -->
9+
<!-- TOC depthFrom:2 -->
1010

11-
- [Developer Guide](#developer-guide)
1211
- [Developing a Plugin](#developing-a-plugin)
1312
- [Packaging plugins for krew](#packaging-plugins-for-krew)
1413
- [Writing a plugin manifest](#writing-a-plugin-manifest)
@@ -23,7 +22,7 @@ available on the krew index.
2322

2423
<!-- /TOC -->
2524

26-
# Developing a Plugin
25+
## Developing a Plugin
2726

2827
Before creating a plugin, read the [Kubernetes Plugins documentation][plugins].
2928

@@ -51,8 +50,7 @@ should be able to call it like:
5150

5251
kubectl foo
5352

54-
55-
## Packaging plugins for krew
53+
### Packaging plugins for krew
5654

5755
To make a plugin installable via krew, you need to:
5856

@@ -67,7 +65,7 @@ is recommended.
6765
It is also possible to get the latest release for a GitHub repository from the
6866
URL: `https://github.com/<user>/<project>/archive/master.zip`.
6967

70-
## Writing a plugin manifest
68+
### Writing a plugin manifest
7169

7270
Each krew plugin has a "plugin manifest" file that lives in the [krew index
7371
repository][krew].
@@ -108,7 +106,7 @@ spec:
108106
description and example usages.
109107
```
110108
111-
### Specifying platform-specific instructions
109+
#### Specifying platform-specific instructions
112110
113111
krew makes it possible to install the same plugin on different operating systems
114112
(like `windows`, `darwin` (macOS), and `linux`) and different architectures
@@ -150,7 +148,7 @@ architectures using the keys `os` and `arch` respectively.
150148
The possible values for `os` and `arch` come from the Go runtime. Run
151149
`go tool dist list` to see all possible platforms and architectures.
152150

153-
### Specifying files to install
151+
#### Specifying files to install
154152

155153
Each operating system may require a different set of files from the archive to
156154
be installed. You can use the `files` field in the plugin manifest to specify
@@ -182,12 +180,13 @@ this:
182180
```
183181

184182
The resulting installation directory would up just with:
185-
```
183+
184+
```text
186185
.
187186
└── krew-foo-windows.exe
188187
```
189188

190-
### Specifying plugin executable
189+
#### Specifying plugin executable
191190

192191
Each `platform` field requires a path to the plugin executable in the plugin's
193192
installation directory.
@@ -215,7 +214,7 @@ plugin name.
215214
> For example, if your is named `view-logs` and your plugin binary is named
216215
> `run.sh`, krew will create a symbolic named `kubectl-view_logs` automatically.
217216

218-
### Specifying a plugin download URL
217+
#### Specifying a plugin download URL
219218

220219
krew plugins must be packaged as `.zip` or `.tar.gz` archives and should be made
221220
available to download publicly.
@@ -233,16 +232,15 @@ Downloading from a versioned URL requires fields:
233232
- `uri`: URL to the archive file (`.zip` or `.tar.gz`)
234233
- `sha256`: sha256 sum of the archive file
235234

236-
237235
Specifying `head` field makes it possible to install a file without verifying
238236
its checksum. If you are downloading from `master` branch of a GitHub
239237
repository, this can be useful. Users can install a plugin using the `head`
240238
with:
241239

242240
kubectl krew install --HEAD <PLUGIN>
243241

244-
It is possible to specify only the `head`, as well as alongside `uri` and `sha256`. In
245-
this case, the `uri` and `sha256` fields will be used by default:
242+
It is possible to specify only the `head`, as well as alongside `uri` and
243+
`sha256`. In this case, the `uri` and `sha256` fields will be used by default:
246244

247245
```yaml
248246
platforms:
@@ -252,9 +250,10 @@ this case, the `uri` and `sha256` fields will be used by default:
252250
...
253251
```
254252

255-
# Installing Plugins Locally
253+
## Installing Plugins Locally
256254

257255
After you have:
256+
258257
- written your `<PLUGIN>.yaml`
259258
- archived your plugin into a `.zip` or `.tar.gz` file
260259

@@ -286,9 +285,9 @@ if you're on a Linux machine, you can test Windows installation with:
286285

287286
After you have tested your plugin, remove it with `kubectl krew remove foo`.
288287

289-
# Publishing Plugins
288+
## Publishing Plugins
290289

291-
## Submitting a plugin to krew
290+
### Submitting a plugin to krew
292291

293292
After you have tested that the plugin can be installed and works you should
294293
create a pull request to the [Krew Index][index] with your `<PLUGIN>.yaml`
@@ -303,7 +302,7 @@ available for all users.
303302
Please make sure to include dependencies of your plugin and extra configuration
304303
needed to run the plugin in the `caveats:` field.
305304

306-
## Updating existing plugins
305+
### Updating existing plugins
307306

308307
When you have a newer version of your plugin, create a new pull request that
309308
updates `uri` and `sha256` fields of the plugin manifest file.

docs/NAMING_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Plugin Naming Style Guide
22

33
This document explain the best practices and recommendations for naming kubectl
4-
plugins. These guidelines are used for reviewing the plugins submitted to
4+
plugins. These guidelines are used for reviewing the plugins submitted to
55
[krew-index](https://github.com/GoogleContainerTools/krew-index) repository.
66

77
#### _Punctuation_

docs/PLUGIN_LIFECYCLE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Plugin Lifecycle
22

3+
(This guide is intended for developers of krew.)
4+
5+
:warning: The instructions below may not be up to date for krew v0.2 and higher.
6+
37
## Installation
48

59
The plugins will be downloaded and checked against its sha256 to verify the

docs/USER_GUIDE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
This guide shows how to use `krew` as a user after installing it.
44

5+
<!-- TOC depthFrom:2 -->
6+
7+
- [Discovering Plugins](#discovering-plugins)
8+
- [Installing Plugins](#installing-plugins)
9+
- [Installing plugins with --HEAD](#installing-plugins-with---head)
10+
- [Listing Installed Plugins](#listing-installed-plugins)
11+
- [Upgrading Plugins](#upgrading-plugins)
12+
- [Uninstalling Plugins](#uninstalling-plugins)
13+
- [Uninstalling Krew](#uninstalling-krew)
14+
15+
<!-- /TOC -->
16+
517
## Discovering Plugins
618

719
To find plugins, run the `kubectl krew search` command. This command lists all
@@ -64,8 +76,8 @@ file.
6476

6577
After installing a plugin, you can use it like `kubectl <PLUGIN>`:
6678

67-
```
68-
$ kubectl ca-cert
79+
```sh
80+
kubectl ca-cert
6981
```
7082

7183
### Installing plugins with --HEAD
@@ -92,7 +104,7 @@ To list all plugins install via `krew`, run:
92104

93105
kubectl krew list
94106

95-
## Plugin Lifecycle
107+
## Upgrading Plugins
96108

97109
Plugins you are using might have newer versions available. To upgrade a single
98110
plugin, run:
@@ -110,14 +122,12 @@ command may also upgrade your `krew` version.
110122
**Note:** Plugins installed via `--HEAD` are always upgraded. This process
111123
allows you to upgrade to the latest commit available in the source repository.
112124

113-
114125
## Uninstalling Plugins
115126

116127
When you don't need a plugin anymore you can uninstall it with:
117128

118129
kubectl krew remove <PLUGIN>
119130

120-
121131
## Uninstalling Krew
122132

123133
Installing `krew` is as easy as deleting its installation directory.

0 commit comments

Comments
 (0)