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
3 changes: 2 additions & 1 deletion cmd/fleet-simulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func main() {
results := site.NewResults(store)
runner := &site.Runner{Site: siteName, Store: store, Results: results, Access: fixture.Access{Enrollment: enrollment},
Kinds: map[string]site.Kind{"DeviceInstallation": simwork.Installation{}, "DeviceWipe": simwork.Wipe{}, "DeviceCommissioning": simwork.Commissioning{}}}
runner.Kinds["DevicePowerOperation"] = simwork.Power{}
dispatcher := &siteapi.Dispatcher{Runner: runner, Context: ctx, Logger: logger}
server := newServer(address, siteapi.Handler(dispatcher, store, results, func() (string, error) { return readToken(tokenPath) }), logger)
if discover {
Expand All @@ -83,7 +84,7 @@ func main() {
}
go func() {
for {
if err := fixture.Discover(ctx, api, enrollment, time.Now()); err != nil && ctx.Err() == nil {
if err := fixture.DiscoverPower(ctx, api, enrollment, time.Now(), simwork.Observe(store)); err != nil && ctx.Err() == nil {
logger.Info("fixture discovery incomplete", "error", err.Error())
}
select {
Expand Down
16 changes: 8 additions & 8 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ production roots, and neither production root may reference them.
`config/overlays/synthetic-staging` is the temporary Milo-routed acceptance
environment. It uses the real Device custody, exclusivity, release, and reuse
implementation, but substitutes synthetic admission and provider evidence. It
accepts only powered-off, networkless claims in `us-central-1`; its status
conditions identify that boundary. The manager still engages every consuming
project, but the synthetic handler and publisher act only for the one
configured consumer project (`consumerProjectName`); every other engaged
project gets blocked lifecycle handlers and requested-hardware resolution. With
the publication keys documented below it uses one distinct provider project,
publishes a locked class reference and exact profile copy into the consumer,
and records both project lifetimes on each allocation. Provider Machine events wake
accepts only networkless claims in `us-central-1` whose power is unset or `Off`;
its status conditions identify that boundary. The manager still engages every
consuming project, but the synthetic handler and publisher act only for the one
configured consumer project (`consumerProjectName`); every other engaged project
gets blocked lifecycle handlers and requested-hardware resolution. With the
publication keys documented below it uses one distinct provider project,
publishes a locked class reference and exact profile copy into the consumer, and
records both project lifetimes on each allocation. Provider Machine events wake
consumer claims directly; no polling resync is enabled.

The simulator is a site. It runs in a separate `fleet-synthetic-provider`
Expand Down
2 changes: 1 addition & 1 deletion config/base/crd/metal.datumapis.com.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ spec:
required: [name]
properties: {name: {type: string, minLength: 1}}
reclaimPolicy: {type: string, enum: [Delete, Retain], default: Delete}
powerState: {type: string, enum: ["On", "Off"], default: "Off"}
powerState: {type: string, enum: ["On", "Off"]}
status:
type: object
x-kubernetes-validations:
Expand Down
2 changes: 0 additions & 2 deletions config/standalone/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ spec:
machineClassRef: {name: standard-metal}
machineProfileRef: {name: general-purpose-24c-128g}
locationRef: {name: us-central-1}
powerState: "Off"
---
apiVersion: metal.datumapis.com/v1alpha1
kind: Machine
Expand All @@ -60,7 +59,6 @@ spec:
machineClassRef: {name: standard-metal}
machineProfileRef: {name: general-purpose-24c-128g}
locationRef: {name: us-central-1}
powerState: "Off"
---
apiVersion: metal.datumapis.com/v1alpha1
kind: Installation
Expand Down
18 changes: 9 additions & 9 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,16 +464,16 @@ it after object creation, so this increment does not fabricate that authority
with annotations or controller credentials.

The opt-in `--synthetic-staging` mode is a temporary acceptance boundary. It
accepts only powered-off, networkless claims in `us-central-1`, synthesizes
clearly labelled admission and provider evidence, and uses the same allocation
library on Device custody as the standalone smoke. The manager also runs the
custody coordinator loop and fixture discovery under its leader lease. It is
event-driven: claim, class, profile, Machine, namespace, and deletion events
route exact work; it adds no periodic re-sync. One synthetic Machine is
accepts only networkless claims in `us-central-1` whose power is unset or `Off`,
synthesizes clearly labelled admission and provider evidence, and uses the same
allocation library on Device custody as the standalone smoke. The manager also
runs the custody coordinator loop and fixture discovery under its leader lease.
It is event-driven: claim, class, profile, Machine, namespace, and deletion
events route exact work; it adds no periodic re-sync. One synthetic Machine is
exclusively bound, competing claims remain pending, release must complete before
finalizer removal, and release wakes waiting claims for reuse.
Public conditions say `SyntheticStagingAdmission`, so this result cannot be
mistaken for Milo caller-preserving authorization.
finalizer removal, and release wakes waiting claims for reuse. Public conditions
say `SyntheticStagingAdmission`, so this result cannot be mistaken for Milo
caller-preserving authorization.

`config/overlays/synthetic-staging` is the only packaged activation path. It
packages the simulator site as a separate single-replica Deployment and
Expand Down
21 changes: 20 additions & 1 deletion docs/development/device-custody.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ marked **implemented and verified**, **implemented and inert**, or
| D: end-to-end failure scenarios | Harness phases and evidence checks for the #174 acceptance tests, and the two site fixes they found. See [Failure scenarios](#failure-scenarios-increment-d). | **Implemented and verified** by unit tests and both multi-plane runs, local VM and Redfish. |
| Commissioning, step 1 | `DeviceCommissioning`, `DeviceCommissioningPlan` and `DeviceCommissioningPlanApproval`: CRDs, ProtectedResources, roles, the creator webhook route, the kind and its rows, plan qualification and the current plan. See [Commissioning](#commissioning). | **Implemented and inert.** Verified by tests against a real API server. No site runs a commissioning worker yet, and no mode creates one. |
| Power P1: control plane | `DevicePowerOperation`, its registry entry, rows, checks, evidence and settle hook, its roles, and the Device field for offered reset types. See [Device power operations](#device-power-operations). | **Implemented.** The kind ships with the component in every root C wires, and the creator webhook, standalone's creator policy and each coordinator's access cover it. Nothing creates power operations yet. Discovery records the reset types each server offers. |
| Power P2 to P4 | The site worker (on B), customer power from `Machine.spec.powerState` (on C), and the UI | **Proposed** |
| Power P2: site worker | The power worker behind the site worker contract, registered at Redfish sites | **Implemented.** No end-to-end run creates power operations yet; see [Worker gaps that remain](#worker-gaps-that-remain). |
| Power P3: customer power | The Metal provider's power request from `Machine.spec.powerState`, the projector's proven power, and the simulator's power worker | **Implemented and verified** against a real API server with the simulator site. No running provider calls it yet. |
| Power P4 | The UI | **Proposed** |

## What Increment A adds

Expand Down Expand Up @@ -1254,6 +1256,17 @@ The lab BMC records `LastResetTime` and adds faults for a withheld request, a
hidden reset time and an identity swap, as [the Redfish
lab](../operations/redfish-lab.md) describes.

### Customer power

| Piece | Decision |
| --- | --- |
| Request | The Metal provider asks the allocator for the Machine's power. `powerState` `On` is the action `On`, and `Off` is `ForceOff`. `powerState` has no default: unset means Fleet does not manage the Machine's power, and no operation is created whatever the server's state, so a freshly installed server that boots on is never forced off. A request created before `powerState` was cleared still runs. Machines stored with `Off` before the default was removed keep it, and stay managed. The operation is named from the allocation and the Machine generation, so a refused one is not created again until the generation changes. A request whose discovery lapsed waits in `Pending` instead, as [the admission checks](#device-power-operations) describe, and runs once discovery reads the server again. If discovery stays away past that bound, the request ends `Failed` and, like any refused one, is not created again until the generation changes. |
| When it is due | When `powerState` differs from the Machine's observed power, or when this allocation's request for another action has not run yet, so a newer request replaces it. A Machine generation runs at most one power operation, so power that drifts after it succeeded is not corrected until the generation changes. Observed power must be `On` or `Off`, so power not yet observed, or `Unknown`, asks for nothing, and no server is forced to a state before its power is known. |
| During a power hold | Observed power is `Unknown`, so nothing is created. After staff apply a `Retry`, the provider creates the retry under the foundation's retry name, repeating the held operation's inputs, and only while `powerState` still maps to the held action. Otherwise staff settle the hold, and the newer request runs after it. |
| Observed power | The manager's power projector stays the only writer of `Machine.status.power`. It reports `Unknown` during any hold or unverified custody, and otherwise the newer of discovery's power state and the state custody's last succeeded power operation proved, a tie going to the operation. When any other operation except a recovery finished at or after discovery's read, power is `Unknown` until discovery reads it again, because that operation may have changed it. |
| Simulator | The simulator site registers a power worker for its simulated servers, and its fixture discovery reports each server's power and offers every action. A restart is proven only by the server's reset time moving to the command. The reset step journals the power read before the command and the send time. A resumed run, whether the step finished or not, reports both, and never treats the command's effect as a server that needed none. A test-only fault makes a server ignore resets, so a power operation ends unknown. |
| Not yet wired | No running provider calls the power request. The synthetic staging provider accepts only Machines that ask for power `Off`, and the harness runners do not change power. |

### Foundation seams power added

Power needed two general seams in the foundation, and adds them rather than
Expand Down Expand Up @@ -1282,6 +1295,11 @@ around here.
operation, and a `Settle` has no real power state to cite. The power phases
need real BMC discovery in the Redfish run, or fixture discovery that
reports the server's power.
- **The two-minute start window against delivery latency.** A power worker
that starts more than two minutes after admission refuses as `Stale`, with
nothing sent. The multi-plane harness allows up to about eight minutes for
Karmada delivery, kro and the worker Pod, so a slow delivery would fail a
power operation safely once a run creates one.
- **A swap before the command is reported as `DeviceIdentityMismatch`.** The
framework verifies the System's identity before a kind runs, with the
shared reason. #173 names this refusal `SystemUUIDMismatch` at the worker.
Expand Down Expand Up @@ -1318,6 +1336,7 @@ a real API server:
| Power: each refusal with custody unchanged, both rows and every other pair, staff racing an allocation, replacement only by the provider row and waiting under a hold, expiry, an early staff retry settling after `Retry`, `Settle` evidence, required evidence, a provider request waiting for discovery (its bound, its replacement, and two coordinators admitting it once), and proof of a success, including a retry's | `TestPowerOperations` |
| A check refusal that waits only on a queue row, within its bound from when the Device was last free, and only with a declared reason; proof of success needs required evidence | `TestExtensionSeams`, `TestRegistryRequiresEvidenceForProofOfSuccess` |
| Power: CEL inputs and evidence pruning, checks, input digest, evidence bounds, registration | `TestPowerCRDRules`, `TestPowerChecks`, `TestPowerInputDigestIsStable`, `TestPowerEvidenceIsTypedAndBounded`, `TestPowerRegistration` |
| Customer power: an unset `powerState` leaving power unmanaged after an install until the Machine asks for `Off`, power under an allocation, waiting behind an installation, a newer request replacing a pending one, a hold reporting `Unknown` through release and settling with fresh discovery, a retry repeating only the held action, a request waiting through a discovery lapse | `TestCustomerPower` |
| Power worker: one reset per action and its proof, sending nothing when already in the requested state, each refusal with nothing sent, a lost response, a request never applied, an unprovable restart, a swap after the command, a resumed worker, two workers for one assignment | `go test ./internal/site/powerwork` |
| The BMC's reset time and the lab's power faults | `TestObserveReadsTheLastResetTime`; the lab adapter self-test |

Expand Down
4 changes: 2 additions & 2 deletions docs/enhancements/machine-lifecycle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ spec:
# Omission requests none. Delete is the default and requires verified release.
addresses: []
reclaimPolicy: Delete
# Off is the default so creating a Machine does not request runtime power-on.
# Unset leaves power unmanaged, so creating a Machine requests no power change.
# On expresses intent; authorization and activation gates still control effects.
powerState: "On"

Expand Down Expand Up @@ -1324,7 +1324,7 @@ release without Milo downtime or machine reprovisioning.

#### Does enabling the feature change any default behavior?

No. MachineCapacity resources default to `Disabled` and Machines to power `Off`.
No. MachineCapacity resources default to `Disabled`, and a Machine without `powerState` leaves its power unmanaged.
Creating or importing records cannot trigger provisioning.

#### Can operators disable the feature after enabling it?
Expand Down
2 changes: 1 addition & 1 deletion docs/enhancements/machine-lifecycle/api-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ spec:
# Omission requests none. Delete is the default and requires verified release.
addresses: []
reclaimPolicy: Delete
# Off is the default so creating a Machine does not request runtime power-on.
# Unset leaves power unmanaged, so creating a Machine requests no power change.
# On expresses intent; authorization and activation gates still control effects.
powerState: "On"

Expand Down
2 changes: 1 addition & 1 deletion docs/enhancements/metal-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ datumctl metal machines wait worker-01 \
```

Require exactly one of `--allocate-only` or `--image` so the handoff is deliberate.
Allocation-only defaults to power off and no network attachments. Its ready
Allocation-only sets power Off and no network attachments. Its ready
message explicitly says: “Allocation handoff complete; no OS installation was
requested; desired power is Off.” It does not claim a bootable machine, guest
connectivity, or application health.
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ integration as a bug.
| Standalone smoke script refuses a cluster | Check for existing Fleet APIs, fixture namespaces, controllers, and context/cluster mismatch; use the required fresh dedicated cluster | [Smoke prerequisites](../operations/standalone-smoke.md#run-with-kind-and-colima) |
| One standalone claim remains pending | The fixture intentionally offers one machine to two consumers; the second binds only after the first releases and cleanup is verified | [Smoke scenario and expected output](../operations/standalone-smoke.md) |
| Smoke output has blank network and address columns | The fixture requests no network interface and does not exercise NSO/IPAM or routing | [Smoke scope](../operations/standalone-smoke.md) |
| Synthetic staging does not publish or allocate as expected | Check the exact publication contract, distinct projects, allowed profile, and powered-off, networkless claim restriction | [Staging configuration and limits](../../config/README.md) |
| Synthetic staging does not publish or allocate as expected | Check the exact publication contract, distinct projects, allowed profile, and networkless claim restriction with power unset or `Off` | [Staging configuration and limits](../../config/README.md) |
| Milo live acceptance returns nonzero or reports `Blocked` | The current harness does not run the live scenario; valid preflight cannot establish `Passed`. Invalid configuration yields `NotRun` evidence when possible | [Acceptance commands](../../test/acceptance/milo/README.md#commands) |
| Acceptance evidence cannot be written or verified | Check the absent-or-empty destination, file permissions, symlink restrictions, and exact three-file evidence contract | [Acceptance evidence](../../test/acceptance/milo/README.md#evidence) |

Expand Down
4 changes: 2 additions & 2 deletions hack/multiplane/steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ case "$step" in
customer="$state/consumer-a/customer-project.json"
k "$customer" -n default delete machine allocation --wait --timeout=60s >/dev/null
k "$customer" -n default create -f - >/dev/null <<'JSON'
{"apiVersion":"metal.datumapis.com/v1alpha1","kind":"Machine","metadata":{"name":"allocation","namespace":"default"},"spec":{"machineClassRef":{"name":"local-class"},"machineProfileRef":{"name":"local-profile"},"locationRef":{"name":"local"},"powerState":"Off"}}
{"apiVersion":"metal.datumapis.com/v1alpha1","kind":"Machine","metadata":{"name":"allocation","namespace":"default"},"spec":{"machineClassRef":{"name":"local-class"},"machineProfileRef":{"name":"local-profile"},"locationRef":{"name":"local"}}}
JSON
"$host" probe-unallocatable --config "$state/acceptance.json" --once
trap - ERR
Expand Down Expand Up @@ -503,7 +503,7 @@ PY
customer="$state/consumer-a/customer-project.json"
k "$customer" -n default delete machine allocation --wait --timeout=60s >/dev/null
k "$customer" -n default create -f - >/dev/null <<'JSON'
{"apiVersion":"metal.datumapis.com/v1alpha1","kind":"Machine","metadata":{"name":"allocation","namespace":"default"},"spec":{"machineClassRef":{"name":"local-class"},"machineProfileRef":{"name":"local-profile"},"locationRef":{"name":"remote-elsewhere"},"powerState":"Off"}}
{"apiVersion":"metal.datumapis.com/v1alpha1","kind":"Machine","metadata":{"name":"allocation","namespace":"default"},"spec":{"machineClassRef":{"name":"local-class"},"machineProfileRef":{"name":"local-profile"},"locationRef":{"name":"remote-elsewhere"}}}
JSON
set +e
"$host" allocate --config "$state/acceptance.json" > "$state/wrong-location.out" 2> "$state/wrong-location.err"
Expand Down
Loading
Loading