From 0320ba387b8ea03586f6253cad40cfe6f8bac088 Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Mon, 10 Mar 2025 00:50:53 +0100 Subject: [PATCH] feat: add plugin to run `vector top` in vector.dev container, hotkey `h` (#3170) --- plugins/README.md | 1 + plugins/vector-dev-top.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 plugins/vector-dev-top.yaml diff --git a/plugins/README.md b/plugins/README.md index e3e0a1b1..86f957f3 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -20,6 +20,7 @@ Following is an example of some plugin files in this directory. Other files are | log_full.yaml | get full logs from pod/container | pods/containers | Ctrl-l | | | resource-recommendations.yaml | View recommendations for CPU/Memory requests based on historical data | deployments/daemonsets/statefulsets | Shift-k | [Robusta KRR](https://github.com/robusta-dev/krr) | | trace-dns.yaml | Trace DNS resolution using Inspektor Gadget (4) | containers/pods/nodes | Shift-d | | +| vector-dev-top.yaml | Run `vector top` in vector.dev container | pods/container | h | [vector top](https://vector.dev/highlights/2020-12-23-vector-top/) | [1]: https://kubernetes.io/docs/tasks/debug/debug-application/debug-running-pod/#ephemeral-container [2]: https://github.com/nicolaka/netshoot diff --git a/plugins/vector-dev-top.yaml b/plugins/vector-dev-top.yaml new file mode 100644 index 00000000..dc487e53 --- /dev/null +++ b/plugins/vector-dev-top.yaml @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2025 Robin Schneider +# +# SPDX-License-Identifier: CC0-1.0 + +plugins: + vector-top: + # t hotkey is already used for "transfer" by k9s. + # Using h because of health. + shortCut: h + confirm: false + description: "Execute `vector top`" + scopes: + - pods + command: sh + background: false + args: + # Both works. I have not read through https://github.com/derailed/k9s/issues/1852 yet. + # - -ic + - -c + - "kubectl exec --context=$CONTEXT --namespace=$NAMESPACE --stdin --tty $NAME -- vector top" + + vector-top-container: + # t hotkey is already used for "transfer" by k9s. + shortCut: h + confirm: false + description: "Execute `vector top`" + scopes: + - containers + command: sh + background: false + args: + - -c + - "kubectl exec --context=$CONTEXT --namespace=$NAMESPACE --stdin --tty $POD --container=$NAME -- vector top"