aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2026-01-05 10:25:37 +0100
committerPatrick Spek <p.spek@tyil.nl>2026-01-05 10:25:37 +0100
commit02266304503ac21f96a8ecd317f4e2e895e32afb (patch)
tree606ef76a0dc80b7a3e69b387b065dd513c123c82
parent0b1fd0203817efdf6751f2c0bab741fbdf7b1181 (diff)
downloaddotfiles-02266304503ac21f96a8ecd317f4e2e895e32afb.tar.gz
dotfiles-02266304503ac21f96a8ecd317f4e2e895e32afb.tar.bz2
Move kubectl-registries and add one for showing images
-rwxr-xr-x.local/bin/kubectl-list-images21
-rwxr-xr-x.local/bin/kubectl-list-registries (renamed from .local/bin/kubectl-registries)2
2 files changed, 22 insertions, 1 deletions
diff --git a/.local/bin/kubectl-list-images b/.local/bin/kubectl-list-images
new file mode 100755
index 0000000..9cc15ce
--- /dev/null
+++ b/.local/bin/kubectl-list-images
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+main() {
+ kubectl get pods \
+ -o jsonpath="{.items[*].spec['initContainers', 'containers'][*].image}" \
+ "$@" \
+ | tr -s '[[:space:]]' '\n' \
+ | while read -r image
+ do
+ if printf "%s" "$image" | cut -d "/" -f 1 | grep -vq "\\."
+ then
+ image="docker.io/$image"
+ fi
+
+ printf "%s\n" "$image"
+ done \
+ | sort \
+ | uniq -c
+}
+
+main "$@"
diff --git a/.local/bin/kubectl-registries b/.local/bin/kubectl-list-registries
index d6b04d2..d927be1 100755
--- a/.local/bin/kubectl-registries
+++ b/.local/bin/kubectl-list-registries
@@ -2,8 +2,8 @@
main() {
kubectl get pods \
- --all-namespaces \
-o jsonpath="{.items[*].spec['initContainers', 'containers'][*].image}" \
+ "$@" \
| tr -s '[[:space:]]' '\n' \
| cut -d "/" -f 1 \
| while read -r registry