Repository navigation
Conversation
Add InventoryObservation (fleet.datumapis.com/v1alpha1) and the fleet-inventory-observer command. An operator names one NetBox device by its stable ID; the observer copies an allowlist of recorded facts into the observation's status with the read time, source revision, a content digest, and the ObservedOnly-v1 trust profile. Observations are evidence, not Devices or capacity. No controller reads them, and they publish no supply and authorize no hardware effect. The observer sends only GET requests to NetBox and writes only the status subresource of existing observations in one namespace. Failed reads keep the last facts and report Observed=False. A name or serial mismatch is an IdentityMismatch, not an update. config/inventory-observer packages the CRD, status-only RBAC, and a CronJob as an opt-in root. No production root references it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Exercise the packaged Role, CRD validation, and status subresource against a real API server: status-only writes, immutable source, stale write conflict, and no trust-profile escalation. CI installs the envtest assets that main already uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sources commonly ban clients that repeat failed authentication, and a ban would also block every other client sharing the observer's egress address. After the first 401 or 403 in a run, mark the remaining observations SourceUnauthorized without another request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closed and replaced. The direction changed: Fleet will not integrate with an external inventory system directly. The reworked change records inventory manually as operator-written, observed-only records, with no client, controller, or CronJob. Renaming the head branch to match closed this PR, so the replacement continues in a new draft PR on |
Contributor
Author
|
Replacement: #90. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and outcome
Fleet has no way to read real hardware records.
MachineCapacity.spec.deviceRefnames a Device, but theDevicekind is still only proposed. Hardware facts reach Fleet only from synthetic writers. To validate inventory integration against real equipment, Fleet must read an existing inventory system without provisioning anything, publishing capacity, or taking ownership.This PR adds
InventoryObservation(fleet.datumapis.com/v1alpha1) and thefleet-inventory-observercommand. An operator names one NetBox device by its stable ID. The observer copies an allowlisted set of that device's recorded facts into the observation's status with the read time, the source revision, a content digest, and theObservedOnly-v1trust profile. Nothing in Fleet reads observations. They publish no supply, reserve nothing, and authorize no hardware effect.Why an observation and not MachineCapacity or Device
MachineCapacityfrom an import would merge the physical-asset and supply identities. It would also put recorded, unverified facts intostatus.hardware, which the allocator matches against profiles.Changes
internal/api/inventory/v1alpha1: types, scheme registration, deepcopy.config/inventory-observer: an opt-in root containing the CRD, a ServiceAccount, a namespace-scoped Role (get/listobservations andupdateon their status only), and a 15-minuteForbidCronJob. No production root references it, and the CRD has no Milo discovery annotation.publish.ymlpins its image to the manager build. The manager image now includes/fleet-inventory-observer.internal/netbox: a read-only client. It sendsGETonly and requires HTTPS (loopback excepted for tests). It does not follow redirects, never follows servernextURLs, caps body and interface counts, and picksBearerfornbt_v2 tokens andTokenotherwise. It decodes an allowlist of fields; custom fields, comments, and config contexts are never decoded.internal/inventoryobserver: refresh semantics.Observed=FalsewithSourceUnavailable,SourceUnauthorized, orSourceObjectMissing.expectedNamemismatch, or a serial that differs from the one previously observed, isIdentityMismatch. The facts are not updated: replaced hardware is a new identity.resourceVersion, so concurrent changes conflict instead of being overwritten.spec.sourceis immutable (CEL), and the status trust profile is restricted toObservedOnly-v1.docs/operations/inventory-observation.md, plus status rows in the architecture, development, operations, and config guides. Deferred decisions are listed there: where operator inventory finally lives, Device registration, hardware facts from a qualified collector, and bulk selection.mainalready has.Verification
go vet ./...andgo test -race ./...pass. The envtest test was also run withKUBEBUILDER_ASSETSset. It runs the observer as its packaged service account against a real API server and checks that:spec.sourceis Invalid;All
kustomize buildroots inci.ymlrender, includingconfig/inventory-observer. The synthetic-staging render, overlay-isolation, standalone, Milo acceptancevalidate, and multiplane harness checks pass.hack/validate-doc-links.shpasses when run with a real ripgrep.hack/test-standalone-build-context.shwas not run locally because there was no Docker daemon. It fails the same way on the base branch locally; CI runs it.One manual run outside CI, with an uncommitted harness: the real observer and client against a live NetBox 4.6.8 (read-only) and a disposable local API server. It recorded one device with
Observed=True, its interfaces, and cable peers. No custom field was copied. That source data is not part of this repository.Not verified: behavior in a deployed cluster. Test fixtures are synthetic.
Stack and deployment note
This PR is based on
pxe/boot-network(#86). That stack predatesmain's multi-project manager and pricing changes, so an environment that already runsmainshould not deploy this branch's bundle directly. A separate integration branch,staging/netbox-inventory, merges currentmainwith this branch. It is for deployment only and is not for review or merge.🤖 Generated with Claude Code