Added kres & kconf

This commit is contained in:
斟酌 鵬兄 2022-08-10 14:03:51 +08:00
parent 139cf98a2b
commit 6bd9a52adb
2 changed files with 14 additions and 0 deletions

View File

@ -38,3 +38,6 @@ alias ssh-add="ssh-add -t 43200"
# Pretty print sqlite3
alias sqlite3="sqlite3 -header -column"
# Kubernetes
alias kconf='kubectl config'

View File

@ -14,3 +14,14 @@ function git-config-as {
echo "Configured as \"$NAME <$EMAIL>\""
}
# Kubernetes
function kres {
local _O _D
_O="-ocustom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name"
_D="[0-9A-Za-z\-]"
if [ -z "$3" ]; then
kubectl get $1 -A $_O | grep "$2"
else
kubectl get $1 -A $_O | grep "$_D*$2$_D*\s\+$_D*$3$_D*"
fi
}