Skip to content

Commit 028a52e

Browse files
authored
Merge pull request #1442 from cert-manager/autocompletion
kubectl plugin: explain how to get autocompletion
2 parents 7049095 + 46a35d0 commit 028a52e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

content/docs/reference/cmctl.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,26 @@ Resources](https://cert-manager.io/docs/releases/upgrading/remove-deprecated-api
352352
$ cmctl upgrade migrate-api-version --qps 5 --burst 10
353353
```
354354

355-
## Legacy kubectl plugin
355+
## Kubectl plugin
356356

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

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

363364
You can run `kubectl cert-manager help` to test that the plugin is set up properly.
365+
366+
### Auto-completion with the kubectl plugin
367+
368+
Since kubectl 1.26, it is possible to enable auto-completion for plugins. Assuming that you installed
369+
`kubectl_cert-manager` in `/usr/local/bin`, you can set up auto-completion by running the following command:
370+
371+
```bash
372+
cat >kubectl_complete-cert_manager <<'EOF'
373+
#!/usr/bin/env sh
374+
kubectl cert-manager __complete "$@"
375+
EOF
376+
sudo install kubectl_complete-cert_manager /usr/local/bin
377+
```

0 commit comments

Comments
 (0)