minor updates
This commit is contained in:
parent
90ff8747c0
commit
07bf96a7c5
|
@ -1 +1 @@
|
|||
Subproject commit 6212cc611f4d54f64dbca18838e4aeaa60f39f71
|
||||
Subproject commit d4b953f20d7f1f02acad1c0dcec17a20be381157
|
|
@ -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))'
|
Loading…
Reference in New Issue