Skip to content

feat: add inventory data view command#212

Closed
ecv wants to merge 1 commit into
mainfrom
feat/inventory-data-view
Closed

feat: add inventory data view command#212
ecv wants to merge 1 commit into
mainfrom
feat/inventory-data-view

Conversation

@ecv

@ecv ecv commented Jun 9, 2026

Copy link
Copy Markdown

What

Adds datumctl inventory — a read view over the Datum Cloud physical inventory (providers, regions, sites, clusters, nodes) now loaded into the inventory.miloapis.com CRDs.

Generic datumctl get <kind> already lists these via the CRDs' additionalPrinterColumns. This command adds the topology navigation and rollups that get cannot express.

Commands

Command Does
inventory providers|regions|sites|clusters|nodes List per kind, curated columns, -o table/json/yaml
inventory tree [--region] region → site → node hierarchy + per-region clusters
inventory summary totals per kind, sites/nodes per region, sites per provider

Design

  • Filters: --region/--site/--cluster resolve server-side via the topology.inventory.miloapis.com/* labels the platform propagates; --provider (and cluster --site) match the spec ref client-side (no topology label exists for those).
  • Defaults to --platform-wide (inventory lives on the platform root); --organization/--project override.
  • Reads via the dynamic client over unstructured objects — datumctl takes no dependency on the inventory Go types.

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

  • Verified against prod (read-only, --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.md added.

Closes #211

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
@ecv

ecv commented Jun 9, 2026

Copy link
Copy Markdown
Author

Verified against prod (read-only)

Staging auth is down, so validated against prod with --platform-wide. All commands read-only (List only).

Lists — real fleet rendered with correct columns + cross-refs + Ready:

  • providers: 4 (aws, gcp, netactuate, vultr)
  • regions: 18 (all Ready)
  • sites: 19 (regionRef/providerRef/type populated)
  • clusters: 18 (region label + controlPlaneSiteRef + role)
  • nodes: 90 (siteRef/clusterRef/role/arch/cpu/phase)

Filters

  • sites --region us-central-1 → 2 sites (server-side region label) ✓
  • nodes --site us-central-1a → site label filter ✓
  • nodes --cluster us-central-1-lab → cluster label filter ✓
  • sites --provider gcp → empty (client-side providerRef; all sites are netactuate) ✓

tree --region us-central-1 → region → clusters line → sites → nodes ✓

summary → totals (4/18/19/18/90), sites+nodes per region, sites per provider. Correctly shows us-central-2: 1 site / 0 nodes (Chicago ISO_ID site, no edge nodes loaded) ✓

json → full unstructured objects render ✓

Functionally complete and confirmed against real data. Left as draft pending review.

@ecv ecv marked this pull request as ready for review June 9, 2026 19:24
@ecv ecv requested a review from scotwells June 9, 2026 19:24
@scotwells

Copy link
Copy Markdown
Contributor

@ecv we shouldn't bake this directly into datumctl. Let's make it a plugin and have the CLI live in the inventory service.

@ecv

ecv commented Jun 9, 2026

Copy link
Copy Markdown
Author

I knew I was forgetting something you said at the bar!

@ecv

ecv commented Jun 11, 2026

Copy link
Copy Markdown
Author

Superseded by milo-os/inventory#41. Per @scotwells' review, this shouldn't bake into datumctl core — it's now a datumctl plugin (datumctl inventory ...) living in the inventory service, using its own typed API. Closing; no datumctl core changes needed (the plugin SDK already covers everything).

@ecv ecv closed this Jun 11, 2026
@ecv ecv deleted the feat/inventory-data-view branch June 11, 2026 15:52
@ecv ecv mentioned this pull request Jun 11, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inventory data view in datumctl

2 participants