1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-21 17:17:59 +00:00

[.zshrc] Add knodes function

This commit is contained in:
Daniel Carrillo 2024-10-23 11:53:44 +02:00
parent fbd8604a03
commit d081f1b383
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

12
.zshrc
View File

@ -88,6 +88,18 @@ kexec () {
[ -n "$cid" ] && kubectl exec -ti "$cid" -- "${cmd[@]}"
}
knodes () {
kubectl get node -o json \
| jq -r '.items[] | {
name:.metadata.name,
type:.metadata.labels."beta.kubernetes.io/instance-type",
karpenter:.metadata.labels."karpenter.sh/nodepool",
capacity:.metadata.labels."karpenter.sh/capacity-type",
registered:.metadata.labels."karpenter.sh/registered",
initialized:.metadata.labels."karpenter.sh/initialized",
} | [.name,.type,.karpenter,.capacity,.registered,.initialized] | @tsv'
}
siteinfo () {
local url=$(echo "$1" | sed 's#^https\?://##')
local ip="$(dig +short "$url" | tail -1)"