Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- run: go test ./...
- run: go test -race ./...
- run: go vet ./...
- run: python3 -m unittest discover -s hack -p test_netbox_inventory.py
- run: go run ./test/acceptance/milo/cmd validate --root .
- run: kustomize build config/base/crd >/dev/null
- run: kustomize build config/milo >/dev/null
Expand Down
1,247 changes: 1,170 additions & 77 deletions config/components/inventory/crds/fleet.datumapis.com.yaml

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions config/components/inventory/protected-resources/cable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: fleet.datumapis.com-cable
spec:
serviceRef:
name: fleet.datumapis.com
kind: Cable
plural: cables
singular: cable
permissions:
- list
- get
- watch
- create
- update
- patch
- delete
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
21 changes: 21 additions & 0 deletions config/components/inventory/protected-resources/facility.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: fleet.datumapis.com-facility
spec:
serviceRef:
name: fleet.datumapis.com
kind: Facility
plural: facilities
singular: facility
permissions:
- list
- get
- watch
- create
- update
- patch
- delete
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ kind: Kustomization
resources:
- deviceclaim.yaml
- device.yaml
- facility.yaml
- rack.yaml
- cable.yaml
- powerfeed.yaml
21 changes: 21 additions & 0 deletions config/components/inventory/protected-resources/powerfeed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: fleet.datumapis.com-powerfeed
spec:
serviceRef:
name: fleet.datumapis.com
kind: PowerFeed
plural: powerfeeds
singular: powerfeed
permissions:
- list
- get
- watch
- create
- update
- patch
- delete
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
21 changes: 21 additions & 0 deletions config/components/inventory/protected-resources/rack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: fleet.datumapis.com-rack
spec:
serviceRef:
name: fleet.datumapis.com
kind: Rack
plural: racks
singular: rack
permissions:
- list
- get
- watch
- create
- update
- patch
- delete
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
16 changes: 16 additions & 0 deletions config/components/inventory/roles/editor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,19 @@ spec:
- fleet.datumapis.com/devices.update
- fleet.datumapis.com/devices.patch
- fleet.datumapis.com/devices.delete
- fleet.datumapis.com/facilities.create
- fleet.datumapis.com/facilities.update
- fleet.datumapis.com/facilities.patch
- fleet.datumapis.com/facilities.delete
- fleet.datumapis.com/racks.create
- fleet.datumapis.com/racks.update
- fleet.datumapis.com/racks.patch
- fleet.datumapis.com/racks.delete
- fleet.datumapis.com/cables.create
- fleet.datumapis.com/cables.update
- fleet.datumapis.com/cables.patch
- fleet.datumapis.com/cables.delete
- fleet.datumapis.com/powerfeeds.create
- fleet.datumapis.com/powerfeeds.update
- fleet.datumapis.com/powerfeeds.patch
- fleet.datumapis.com/powerfeeds.delete
12 changes: 12 additions & 0 deletions config/components/inventory/roles/viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ spec:
- fleet.datumapis.com/devices.list
- fleet.datumapis.com/devices.get
- fleet.datumapis.com/devices.watch
- fleet.datumapis.com/facilities.get
- fleet.datumapis.com/facilities.list
- fleet.datumapis.com/facilities.watch
- fleet.datumapis.com/racks.get
- fleet.datumapis.com/racks.list
- fleet.datumapis.com/racks.watch
- fleet.datumapis.com/cables.get
- fleet.datumapis.com/cables.list
- fleet.datumapis.com/cables.watch
- fleet.datumapis.com/powerfeeds.get
- fleet.datumapis.com/powerfeeds.list
- fleet.datumapis.com/powerfeeds.watch
78 changes: 69 additions & 9 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,58 @@ service catalog's consumer provider (`internal/projectdiscovery`). There is no
consumer set. It does not release custody, call a provider, delete records,
or rewrite status, including for a project with active custody. Its
deadlines and queued events are dropped, and re-engagement resumes from the
retained private records.
retained private records. Unbinding drains direct and dependency-route
reconciliations that already acquired the runtime before removing it from the
registry; a retained runtime pointer cannot start work after that barrier.
A blocked in-flight handler therefore delays completed departure rather than
falsely reporting it. This fixes an inherited race where informer removal and
registry removal could finish while a handler could still write. It does not
roll back effects already admitted before departure. Regression tests block a
handler explicitly and assert the barrier, in addition to the active-custody
no-write/no-release test.
Re-engagement also drains the previous runtime before publishing either
registry entry, so a new lifecycle owner's independent request locks cannot
overlap old work. The wait never holds the registry mutex. After waiting,
engagement rechecks both the cluster pointer and project-lifetime ownership;
a concurrent successor must itself drain, and a conflicting route is refused.
Cancellation aborts the waiting engagement without publishing its runtime or
engaging its controllers. An already initiated drain continues to completion;
it is not rolled back into an active runtime. Cancellation retires the prior
entry after its drain completes, without removing a concurrent successor.
A handler that never returns still prevents safe replacement; cancellation is
not evidence that its effects have stopped. Deterministic direct/routed replacement,
cancellation, stale-pointer, registry-revalidation and concurrent engagement
tests cover these process-local barriers, not distributed executor fencing.
A per-cluster-route engagement gate also serializes publication through the
entire downstream controller setup call and failure cleanup. Draining alone
was insufficient: a paused predecessor's setup could otherwise resume after
its successor and replace the successor's controller watches. The gate is
acquired after effect-free runtime construction; waiting is context-cancellable
and never holds the registry mutex. Cancelling a waiter does not stop the
current runtime. Gates are reference-counted and removed after their last
holder or waiter leaves; unrelated routes remain independent. Project-lifetime
conflicts across routes are still checked under the registry mutex.
Each published runtime owns a child engagement context, cancelled when its
drain begins. This cancels partial downstream engagements on failure and invalidates
the old context even when replacement uses the same cluster implementation.
Cancellation starts draining immediately, but cleanup cannot remove lifetime
ownership or admit a successor until downstream setup returns and admitted
handlers finish. A downstream call that ignores cancellation therefore blocks
that route rather than allowing an unfenced successor. A setup that returns
nil after cancellation is reported as cancelled, not successful engagement.
Cleanup under an already-held gate uses a separate internal path, avoiding
recursive locking; stale cleanup can only cancel and remove its own runtime.
Downstream setup may read the registries and engage another route. Synchronous
recursion back into a held route with the supplied context is rejected with
`ErrProjectEngagementReentrant`, including cycles through another route.
Nested setup also refuses to wait on any other occupied route in this registry,
preventing two concurrent callbacks from deadlocking by requesting each
other's routes. Ordinary independent callers still wait cancellably.
Callbacks must propagate that context rather than create a detached context
and synchronously wait on their own engagement. Deterministic regressions
cover blocked setup, direct/dependency handlers, failed/cancelled setup,
cancelled waiters, cross-route lifetime transfer, stale cleanup, unrelated
progress, reentrant setup and same-implementation context replacement.
- **Observational discovery.** The provider declares no managed resources,
teardowns, or suspend hooks, so it adds no ServiceConsumer finalizer. Its
discovery clients refuse every write. The library would otherwise patch
Expand Down Expand Up @@ -704,22 +755,31 @@ corrupt or uses an unsupported schema version.

## Physical inventory subset

`internal/api/inventory/v1alpha1` defines `DeviceClaim`, the plan for one rack
slot, and `Device`, the asset bound to one claim. Operators write both by hand
into the provider project in Milo. `config/components/inventory` holds their
`internal/api/inventory/v1alpha1` defines Facility, Rack, DeviceClaim, Device,
Cable and PowerFeed records. Legacy slot claims coexist with new observational
installation claims; no move or replacement handover is automated. Records live
in the provider project in Milo. `config/components/inventory` holds their
CRDs, ProtectedResources, and the `fleet.datumapis.com-inventory-viewer` and
`-editor` roles. Only `config/milo` includes it.

CEL requires `Manual` provenance on both kinds and requires every edit to
CEL requires `Manual` or source-attributed `NetBoxImport` provenance and every edit to
advance `recordedAt`. It keeps a Device's `claimRef` and identity immutable,
rejects duplicate or ambiguous MACs, and accepts only credential-free `https`
BMC endpoints. Status is a reserved subresource with no fields and no writer.
No metal role grants inventory access.

The staff portal plugin's read-only Inventory tab lists claims and shows each
claim's bound Devices. Unit tests run the API server's validation offline and
check the IAM shape. See
[Planning and registering physical devices](../operations/physical-inventory.md).
The staff portal plugin's read-only Inventory tab pages through all six kinds,
shows physical relationships and components, and can inspect a private import
report locally. Multiple historical bindings remain ambiguous rather than being
resolved by edit time. The primary workflow is [manual entry and review](../operations/physical-inventory.md#manually-record-a-small-installation)
through the existing Flux writer, with no NetBox dependency. The optional,
operator-invoked standard-library `hack/netbox_inventory.py` reads GET-only snapshots
and generates offline review candidates; it never applies, schedules, synchronizes,
deletes or changes Git. Unit tests run API-server validation offline,
check IAM and exercise pagination, source conflicts, omissions and interrupted
imports. See [safe NetBox evaluation](../operations/netbox-physical-import.md).
No live source coverage, deployment of this physical extension, physical verification, concurrent
reservation, deletion safety, adoption or new hardware-effect path is established.

## Build, test, and run

Expand Down
1 change: 1 addition & 0 deletions docs/operations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ integrations. Real provider support and live Milo acceptance tests are incomplet
| Drive the same pipeline through Redfish instead of libvirt | [Redfish-mode acceptance](redfish-lab.md) (`task multiplane:redfish-acceptance`) | Redfish executor discovery, one-time PXE/disk boot overrides, power, lost-response recovery and a booted wipe cleanup, against the unmodified DMTF Redfish Interface Emulator with a lab-only libvirt adapter and two persistent lab VMs; synthetic credentials and networking; not physical BMC or hardware qualification |
| Publish physical-side DHCP reservations for network boot | [Boot network](boot-network.md) | Per-asset BMC endpoints and provisioning attachments, a reservation feed that exists only while a boot is admitted, served and withdrawn evidence from the DHCP owner's Kea synchronizer; unit tested, not exercised at a site |
| Plan a rack slot and register the server bound to it | [Planning and registering physical devices](physical-inventory.md) | Operator-written `DeviceClaim` and `Device` records in the provider project in Milo, with attributable provenance and immutable identity and binding, shown read-only in the staff portal; no capacity or hardware effect; unit tested |
| Optionally compare an existing NetBox source | [Operator-run snapshot and candidate review](netbox-physical-import.md) | Optional local review aids only; manual inventory needs no NetBox, automated migration or live import |
| Render deployment bundles and supply environment inputs | [Deployment manifests](../../config/README.md) | Packaging and security boundaries, not runtime readiness |
| Run the manager across consuming projects | [Project discovery](../../config/README.md#project-discovery) | Discovery, per-project isolation, departure, role bindings, and readiness |
| Exercise Milo-routed synthetic staging | [Synthetic staging configuration](../../config/README.md#environment-owned-inputs) | Restricted synthetic publication and lifecycle behavior, not production authority |
Expand Down
Loading
Loading