From b97885ce0cd072ad6ea7f53f89f4c0799d50b44e Mon Sep 17 00:00:00 2001 From: Mattis <115666021+MattisJensen@users.noreply.github.com> Date: Fri, 10 Oct 2025 15:05:25 +0200 Subject: [PATCH] feat: plugin to list all resources by namespace (#3619) * Plugin to list all resources by namespace (closes #3618) * add get-all-namespace-resources.yaml plugin to plugins table --- plugins/README.md | 1 + plugins/get-all-namespace-resources.yaml | 47 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 plugins/get-all-namespace-resources.yaml diff --git a/plugins/README.md b/plugins/README.md index 1bfa6aef..78059a05 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -14,6 +14,7 @@ Following is an example of some plugin files in this directory. Other files are | dive.yaml | Dive image layers | containers | d | [Dive](https://github.com/wagoodman/dive) | | dup.yaml | Duplicate, edit and Debug resources | all | Shift-d/e/v | [dup](https://github.com/vash/dup) | | external-secrets.yaml | Refresh external/push-secrets | externalsecrets/pushsecrets | Shift-R | [External Secrets](https://external-secrets.io) | +| get-all-namespace-resources.yaml | List all namespace resources (using standard kubectl) | all | m | [kubectl](https://kubernetes.io/docs/tasks/tools/) | | get-all.yaml | get all resources in a namespace | all | g | [Krew](https://krew.sigs.k8s.io/), [ketall](https://github.com/corneliusweig/ketall/) | | helm-diff.yaml | Diff with previous revision / current revision | helm/history | Shift-D/Q | [helm-diff](https://github.com/databus23/helm-diff) | | job-suspend.yaml | Suspends a running cronjob | cronjobs | Ctrl-s | | diff --git a/plugins/get-all-namespace-resources.yaml b/plugins/get-all-namespace-resources.yaml new file mode 100644 index 00000000..efc1c59b --- /dev/null +++ b/plugins/get-all-namespace-resources.yaml @@ -0,0 +1,47 @@ +plugins: + get-all-resources-by-selected-namespace: + shortCut: m + confirm: false + description: List all resources of the selected namespace + scopes: + - namespaces + command: sh + background: false + args: + - -c + - 'for r in $(kubectl api-resources --verbs=list --namespaced -o name); do out=$(kubectl get --ignore-not-found --show-kind -n $NAME $r 2>/dev/null); if [ -n "$out" ]; then echo "$out"; echo ""; fi; done | less' + get-all-resources-in-current-namespace: + shortCut: m + confirm: false + description: List all resources of the current namespace + scopes: + - configmaps + - controllerrevisions + - daemonsets + - deployments + - endpoints + - endpointslices + - events + - horizontalpodautoscalers + - ingresses + - jobs + - leases + - limitranges + - networkpolicies + - persistentvolumeclaims + - poddisruptionbudgets + - pods + - replicasets + - replicationcontrollers + - resourcequotas + - rolebindings + - roles + - secrets + - serviceaccounts + - services + - statefulsets + command: sh + background: false + args: + - -c + - 'for r in $(kubectl api-resources --verbs=list --namespaced -o name); do out=$(kubectl get --ignore-not-found --show-kind -n $NAMESPACE $r 2>/dev/null); if [ -n "$out" ]; then echo "$out"; echo ""; fi; done | less' \ No newline at end of file