log with instance name from label

This commit is contained in:
hophacker 2020-08-26 10:23:55 +08:00
parent c48ee19aa8
commit 224552e020
2 changed files with 10 additions and 2 deletions

View File

@ -217,7 +217,7 @@ alias brewu='brew update && brew upgrade && brew cleanup && brew doctor'
alias emacs="env LC_CTYPE=zh_CN.UTF-8 emacs"
# rails
alias rails_setup='rails db:reset db:seed'
alias rails_setup='rails db:reset; rails db:seed RAILS_ENV=test'
alias rails_test='rspec && rubocop'
alias rubocop='rubocop --require rubocop-performance --format progress'
alias psetup='rake parallel:setup'

View File

@ -389,6 +389,10 @@ function klogs {
PROJECT="$2"
shift; shift
;;
-i)
INSTANCE="$2"
shift; shift
;;
*)
finalopts+=($1)
shift
@ -396,7 +400,11 @@ function klogs {
esac
done
kubectl --context $KCONTEXT logs -f deployment/$PROJECT --all-containers=true --since=5s --pod-running-timeout=2s $finalopts
if [[ "$PROJECT" != "" ]]; then
kubectl --context $KCONTEXT logs -f deployment/$PROJECT --all-containers=true --since=5s --pod-running-timeout=2s $finalopts
elif [[ "$INSTANCE" != "" ]]; then
kubectl --context $KCONTEXT logs -f --max-log-requests=10 -l app.kubernetes.io/instance=$INSTANCE
fi
}
function rgm {