feat: add inventory data view command#212
Conversation
Add `datumctl inventory`, a read view over the Datum Cloud physical inventory (providers, regions, sites, clusters, nodes) loaded into the inventory.miloapis.com CRDs. Generic `get` already lists these via the CRDs' printer columns; this adds the topology navigation and rollups that `get` cannot express. Key features: - List subcommands per kind (providers, regions, sites, clusters, nodes) with curated default columns and -o table/json/yaml - Filter flags --region/--site/--cluster resolve server-side via the topology.inventory.miloapis.com/* labels; --provider matches the site providerRef client-side - `inventory tree` prints the region -> site -> node hierarchy with per-region clusters; `inventory summary` prints fleet-wide counts - Defaults to --platform-wide (inventory lives on the platform root); --organization/--project override - Reads via the dynamic client over unstructured objects, so datumctl takes no dependency on the inventory Go types Closes #211
Verified against prod (read-only)Staging auth is down, so validated against prod with Lists — real fleet rendered with correct columns + cross-refs + Ready:
Filters
tree summary → totals (4/18/19/18/90), sites+nodes per region, sites per provider. Correctly shows json → full unstructured objects render ✓ Functionally complete and confirmed against real data. Left as draft pending review. |
|
@ecv we shouldn't bake this directly into datumctl. Let's make it a plugin and have the CLI live in the inventory service. |
|
I knew I was forgetting something you said at the bar! |
|
Superseded by milo-os/inventory#41. Per @scotwells' review, this shouldn't bake into datumctl core — it's now a datumctl plugin ( |
What
Adds
datumctl inventory— a read view over the Datum Cloud physical inventory (providers, regions, sites, clusters, nodes) now loaded into theinventory.miloapis.comCRDs.Generic
datumctl get <kind>already lists these via the CRDs'additionalPrinterColumns. This command adds the topology navigation and rollups thatgetcannot express.Commands
inventory providers|regions|sites|clusters|nodes-o table/json/yamlinventory tree [--region]inventory summaryDesign
--region/--site/--clusterresolve server-side via thetopology.inventory.miloapis.com/*labels the platform propagates;--provider(and cluster--site) match thespecref client-side (no topology label exists for those).--platform-wide(inventory lives on the platform root);--organization/--projectoverride.Tests
8 unit tests covering field extraction, row formatting, client-side filtering, tree, summary tally/union, and json/yaml rendering of unstructured lists.
go test ./...green.Verification
--platform-wide) — staging auth was down. All lists, filters, tree, summary, and json output confirmed against the real fleet (4 providers / 18 regions / 19 sites / 18 clusters / 90 nodes). See verification comment below.Docs
docs/inventory.mdadded.Closes #211