$ show yashbhutwala/kubectl-df-pv
kubectl-df-pv is a kubectl plugin that displays disk usage (like the Unix `df` command) for Kubernetes Persistent Volumes. It retrieves storage metrics from each node's kubelet stats/summary endpoint and presents them in a color-coded, human-readable table. The tool handles concurrent node queries using goroutines and channels, supports filtering by namespace, and allows users to select which columns to display (including inode information). It auto-converts byte sizes to IEC binary prefixes (Ki, Mi, Gi, Ti) and colorizes usage percentages (red > 75%, yellow < 25%, green otherwise). The codebase is a single Go binary using Cobra for CLI parsing, client-go for Kubernetes API interaction, and go-pretty for table rendering. It is a well-structured, focused utility that solves a specific operational need for Kubernetes administrators. While the core logic is solid, the project is relatively simple and does not exhibit exceptional architectural depth or highly reusable components beyond basic byte formatting.
The LLM identified 1 files worth highlighting for reuse:
The `ConvertQuantityValueToHumanReadableIECString` function is a self-contained utility that converts a Kubernetes `resource.Quantity` (representing byte capacity) into a human-readable IEC binary string (e.g., '1.5Gi', '10Ti'). It handles edge cases like zero and negative values, uses only standard library and k8s.io/apimachinery, and does not import any internal package modules. This function is safely extractable into a standalone Go package for use in any project requiring IEC byte formatting.