clear and fix docker k8s related functions

This commit is contained in:
hophacker 2021-10-12 02:34:26 +08:00
parent 30385f388e
commit fb09350b42
2 changed files with 24 additions and 24 deletions

View File

@ -284,29 +284,6 @@ function stern {
echo "stern $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config" echo "stern $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
command stern $finalopts -t --since 10m --kubeconfig=$HOME/.kube/${KCONTEXT}_config command stern $finalopts -t --since 10m --kubeconfig=$HOME/.kube/${KCONTEXT}_config
} }
function helm() {
DEBUG=false
finalopts=()
while [[ $@ != "" ]] do
case $1 in
--context=*)
KCONTEXT="${i#*=}"
shift
;;
--debug)
DEBUG=true
finalopts+=($1)
shift
;;
*)
finalopts+=($1)
shift
;;
esac
done
[[ $DEBUG == "true" ]] && echo "helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
command helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config
}
function rgm { function rgm {
args=("${(@s/,/)1}") args=("${(@s/,/)1}")

View File

@ -1,7 +1,6 @@
NAMESPACE=default NAMESPACE=default
RUNNING_POD="" RUNNING_POD=""
LEFT_ARGS="" LEFT_ARGS=""
KCONTEXT=""
VERBOSE=false VERBOSE=false
SRC="" SRC=""
DST="" DST=""
@ -190,3 +189,27 @@ function set_k8s_context_core {
fi fi
export KCONTEXT=$C export KCONTEXT=$C
} }
function helm() {
DEBUG=false
finalopts=()
while [[ $@ != "" ]] do
case $1 in
--context=*)
KCONTEXT="${i#*=}"
shift
;;
--debug)
DEBUG=true
finalopts+=($1)
shift
;;
*)
finalopts+=($1)
shift
;;
esac
done
[[ $DEBUG == "true" ]] && echo "helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
command helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config
}