|
|
|
|
@ -103,4 +103,38 @@ if [ -f "/Users/jetpac/.local/bin/k9s" ]; then |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# lh nodes function for kubectl |
|
|
|
|
if [[ -n ${commands[kubectl]} ]]; then |
|
|
|
|
lh_nodes() { |
|
|
|
|
local ns="${1:-longhorn-system}" |
|
|
|
|
kubectl -n "$ns" get nodes.longhorn.io -o yaml | \ |
|
|
|
|
yq eval ' |
|
|
|
|
.items[] | |
|
|
|
|
{ |
|
|
|
|
"node": .metadata.name, |
|
|
|
|
"allowScheduling": .spec.allowScheduling, |
|
|
|
|
"disks": ( |
|
|
|
|
[ (.spec.disks // {}) | to_entries | .[] | |
|
|
|
|
{ |
|
|
|
|
"diskName": .key, |
|
|
|
|
"path": .value.path, |
|
|
|
|
"allowScheduling": .value.allowScheduling, |
|
|
|
|
"evictionRequested": .value.evictionRequested, |
|
|
|
|
"storageReservedGiB": ((.value.storageReserved // 0) / 1073741824) |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
), |
|
|
|
|
"diskStatus": ( |
|
|
|
|
[ (.status.diskStatus // {}) | to_entries | .[] | |
|
|
|
|
{ |
|
|
|
|
"diskName": .key, |
|
|
|
|
"storageAvailableGiB": ((.value.storageAvailable // 0) / 1073741824), |
|
|
|
|
"storageMaximumGiB": ((.value.storageMaximum // 0) / 1073741824), |
|
|
|
|
"storageScheduledGiB":((.value.storageScheduled // 0) / 1073741824) |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
}' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fi |
|
|
|
|
|