move k8s related functions into k8s.zsh
This commit is contained in:
parent
b46399dbb8
commit
6b3d0b0167
@ -216,12 +216,6 @@ alias brewu='brew update && brew upgrade && brew cleanup && brew doctor'
|
||||
# emacs
|
||||
alias emacs="env LC_CTYPE=zh_CN.UTF-8 emacs"
|
||||
|
||||
# k8s
|
||||
alias k="kubectl"
|
||||
alias kpg="kubectl get pods | grep"
|
||||
alias ksg="kubectl get service | grep"
|
||||
alias k_get_pods_sort_by_time="k get pods --sort-by=.metadata.creationTimestamp"
|
||||
|
||||
# rails
|
||||
alias rails_setup='rails db:reset; rails db:seed RAILS_ENV=test'
|
||||
alias rails_test='rspec && rubocop'
|
||||
|
16
zsh/k8s.zsh
16
zsh/k8s.zsh
@ -2,6 +2,13 @@ NAMESPACE=default
|
||||
RUNNING_POD=""
|
||||
LEFT_ARGS=""
|
||||
KCONTEXT=""
|
||||
|
||||
# aliases
|
||||
alias k="kubectl"
|
||||
alias kpg="kubectl get pods | grep"
|
||||
alias ksg="kubectl get service | grep"
|
||||
alias k_get_pods_sort_by_time="k get pods --sort-by=.metadata.creationTimestamp"
|
||||
|
||||
function getpod {
|
||||
RAN=true
|
||||
function usage ()
|
||||
@ -157,3 +164,12 @@ function k_force_delete_pod () {
|
||||
function k_get_containers_of_pod {
|
||||
k get pods $1 -o jsonpath='{.spec.containers[*].name}*'
|
||||
}
|
||||
function set_k8s_context_core {
|
||||
C=$1
|
||||
if [[ "$C" == "" ]]; then
|
||||
echo "Select your context:"
|
||||
ls ~/.kube/*_config | xargs -n 1 basename | sed s/_config//g
|
||||
read C
|
||||
fi
|
||||
export KCONTEXT=$C
|
||||
}
|
||||
|
@ -69,13 +69,7 @@ function prompt_skwp_setup {
|
||||
alias disable_git_info='DISABLE_GIT_INFO=1'
|
||||
alias enable_git_info='DISABLE_GIT_INFO=0'
|
||||
function set_k8s_context {
|
||||
C=$1
|
||||
if [[ "$C" == "" ]]; then
|
||||
echo "Select your context:"
|
||||
ls ~/.kube/*_config | xargs -n 1 basename | sed s/_config//g
|
||||
read C
|
||||
fi
|
||||
export KCONTEXT=$C
|
||||
set_k8s_context_core $*
|
||||
prompt_skwp_setup
|
||||
}
|
||||
prompt_skwp_setup
|
||||
|
Loading…
Reference in New Issue
Block a user