titan-iac/scripts/ops/longhorn_volume_usage.fish
jenkins 0da9e4c82d refactor: restructure services layout, retire oceanus, add aether scaffolding
- Move flat service manifests into structured subdirs (apps/, bootstrap-jobs/,
  repair-jobs/, migration-jobs/, validation-jobs/, node-ops/, networking/)
- Retire oneoffs/ directories across services
- Remove oceanus cluster and its host roles; add aether cluster + terraform scaffolding
- Reorganize scripts/ into ops/, render/, sync/, manual-tests/
- Add Makefile with render/validate/test/flux targets and repo-structure tests
- Update flux-system application CRs to the new paths
- Add hermes-automated-triage-24h-plan knowledge doc (+ comms mirror)
- Refresh knowledge catalogs, dashboards, vmalert rules, quality contract

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 16:21:36 -03:00

26 lines
920 B
Fish
Executable File

#!/usr/bin/env fish
function pvc-usage --description "Show Longhorn PVC usage mapped to namespace/name"
begin
kubectl -n longhorn-system get volumes.longhorn.io -o json \
| jq -r '.items[] | "\(.metadata.name)\t\(.status.actualSize)\t\(.spec.size)"' \
| sed 's/^/V\t/'
kubectl get pvc -A -o json \
| jq -r '.items[] | "\(.spec.volumeName)\t\(.metadata.namespace)/\(.metadata.name)"' \
| sed 's/^/P\t/'
end \
| awk 'BEGIN{FS="\t"}
$1=="V"{vol=$2; vu[vol]=$3; vs[vol]=$4}
$1=="P"{vol=$2; name=$3; map[vol]=name}
END{
for (v in vu){
used=vu[v]+0; size=vs[v]+0; pct=(size>0?used/size*100:0);
cmd="numfmt --to=iec --suffix=B " used; cmd|getline hu; close(cmd);
cmd="numfmt --to=iec --suffix=B " size; cmd|getline hs; close(cmd);
n=(v in map?map[v]:v);
printf "%-40s %-10s / %-10s (%5.1f%%)\n", n, hu, hs, pct
}
}' | sort
end