extract function get pod
This commit is contained in:
parent
9496c8659d
commit
a91b7dde6e
@ -232,6 +232,9 @@ function gitcopy() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function kubectl() {
|
function kubectl() {
|
||||||
|
echo $RUNNING_POD
|
||||||
|
echo $NAMESPACE
|
||||||
|
echo $KCONTEXT
|
||||||
DEBUG=false
|
DEBUG=false
|
||||||
finalopts=()
|
finalopts=()
|
||||||
while [[ $@ != "" ]] do
|
while [[ $@ != "" ]] do
|
||||||
@ -255,6 +258,7 @@ function kubectl() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
[[ $DEBUG == "true" ]] && echo "kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts"
|
[[ $DEBUG == "true" ]] && echo "kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts"
|
||||||
|
echo "kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts"
|
||||||
command kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts
|
command kubectl --kubeconfig=$HOME/.kube/${KCONTEXT}_config $finalopts
|
||||||
}
|
}
|
||||||
function stern {
|
function stern {
|
||||||
@ -297,9 +301,12 @@ function helm() {
|
|||||||
[[ $DEBUG == "true" ]] && echo "helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
|
[[ $DEBUG == "true" ]] && echo "helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config"
|
||||||
command helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config
|
command helm $finalopts --kubeconfig=$HOME/.kube/${KCONTEXT}_config
|
||||||
}
|
}
|
||||||
function kexec {
|
|
||||||
RAN=true
|
|
||||||
NAMESPACE=default
|
NAMESPACE=default
|
||||||
|
RUNNING_POD=""
|
||||||
|
LEFT_ARGS=""
|
||||||
|
KCONTEXT=""
|
||||||
|
function getpod {
|
||||||
|
RAN=true
|
||||||
function usage ()
|
function usage ()
|
||||||
{
|
{
|
||||||
echo "Usage : $0 [options] [--]
|
echo "Usage : $0 [options] [--]
|
||||||
@ -370,9 +377,15 @@ function kexec {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ $RUNNING_POD_INDEX != -1 ]]; then
|
RUNNING_POD=$RUNNING_PODS[$RUNNING_POD_INDEX]
|
||||||
echo "kubectl -it -n $NAMESPACE exec $RUNNING_PODS[$RUNNING_POD_INDEX] -- $@"
|
LEFT_ARGS=$@
|
||||||
kubectl -it -n $NAMESPACE exec $RUNNING_PODS[$RUNNING_POD_INDEX] -- $@
|
}
|
||||||
|
|
||||||
|
function kexec {
|
||||||
|
getpod $@
|
||||||
|
if [[ $RUNNING_POD != "" ]]; then
|
||||||
|
echo "kubectl -it -n $NAMESPACE exec $RUNNING_POD -- /bin/sh -c $LEFT_ARGS"
|
||||||
|
kubectl -it -n $NAMESPACE exec $RUNNING_POD -- /bin/sh -c $LEFT_ARGS
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user