1
0
Fork 0

minor updates

This commit is contained in:
Luca Bilke 2024-05-02 19:44:43 +02:00
parent 90ff8747c0
commit 07bf96a7c5
No known key found for this signature in database
GPG Key ID: AD6630D0A1E650AC
2 changed files with 41 additions and 1 deletions

@ -1 +1 @@
Subproject commit 6212cc611f4d54f64dbca18838e4aeaa60f39f71
Subproject commit d4b953f20d7f1f02acad1c0dcec17a20be381157

View File

@ -0,0 +1,40 @@
#compdef kube
local curcontext="$curcontext" state line expl ret=1
function _kube_clusters() {
find "$TRALIOS_KUBECONFIG_DIR" \
-maxdepth 1 \
-type f \
-regex ".*\.ya?ml" |
xargs -n 1 basename |
sed 's/\.ya\?ml$//'
}
function _kube_args() {
index=$1
kubeconfig=$(find "$TRALIOS_KUBECONFIG_DIR" -maxdepth 1 -type f -regex ".*/${words[3]}\.ya?ml")
case "${words[2]}" in
(shell)
case "$index" in
(3)
kubectl --kubeconfig "${kubeconfig}" get namespaces | tail -n +2 | awk "{ print \$1 }"
;;
(4)
kubectl --kubeconfig "${kubeconfig}" -n "${words[4]}" get pods | tail -n +2 | awk "{ print \$1 }"
;;
esac
;;
(pv_migrate)
if [ "$index" = "3" ]; then
_kube_clusters
fi
;;
esac
}
_arguments '1:action:(shell k9s ctl dash prom traefik rook debug_start debug_kill pv_migrate)'
_arguments '2:cluster:($(_kube_clusters))'
_arguments '3:arguments:($(_kube_args 3))'
_arguments '4:arguments:($(_kube_args 4))'