Skip to content

Commit

Permalink
Merge pull request #1442 from cert-manager/autocompletion
Browse files Browse the repository at this point in the history
kubectl plugin: explain how to get autocompletion
  • Loading branch information
jetstack-bot authored Mar 13, 2024
2 parents 7049095 + 46a35d0 commit 028a52e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions content/docs/reference/cmctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,26 @@ Resources](https://cert-manager.io/docs/releases/upgrading/remove-deprecated-api
$ cmctl upgrade migrate-api-version --qps 5 --burst 10
```

## Legacy kubectl plugin
## Kubectl plugin

While the kubectl plugin is supported, it is recommended to use `cmctl` as this enables a better experience via tab auto-completion.
Since kubectl 1.26, kubectl plugins support auto-completion, which means you will have the same
experience with the standalone `cmctl` binary and with the kubectl plugin.

To install the plugin you need the `kubectl_cert-manager` file for the platform you're using,
these can be found on our [cmctl GitHub releases page](https://github.com/cert-manager/cmctl/releases).
In order to use the kubectl plugin you need its binary to be accessible under the name `kubectl-cert_manager` in your `$PATH`.

You can run `kubectl cert-manager help` to test that the plugin is set up properly.

### Auto-completion with the kubectl plugin

Since kubectl 1.26, it is possible to enable auto-completion for plugins. Assuming that you installed
`kubectl_cert-manager` in `/usr/local/bin`, you can set up auto-completion by running the following command:

```bash
cat >kubectl_complete-cert_manager <<'EOF'
#!/usr/bin/env sh
kubectl cert-manager __complete "$@"
EOF
sudo install kubectl_complete-cert_manager /usr/local/bin
```

0 comments on commit 028a52e

Please sign in to comment.