From 340bbb3472475e47450a94fb9349d5251c51a363 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 19:54:06 -0600 Subject: [PATCH 01/11] docs: Propose physical attachment for servers Fleet allocates bare-metal servers and needs NSO to attach a server's NIC, through its switch port, to customer networks and to a provider-owned boot network. NSO's attachment modes all assume a node. This proposes a Physical attachment mode with an attachment point on the claim, provider-only admission, one project holding a switch port at a time, detach before release, and a release that waits for IPAM to confirm the addresses are freed. Key changes: - add the physical attachment enhancement, all of it proposed - list the decisions that need Fleet and the Networking team Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 601 +++++++++++++++++++++++ 1 file changed, 601 insertions(+) create mode 100644 docs/enhancements/physical-attachment.md diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md new file mode 100644 index 00000000..a5e68dd6 --- /dev/null +++ b/docs/enhancements/physical-attachment.md @@ -0,0 +1,601 @@ +--- +status: provisional +stage: alpha +latest-milestone: "v0.x" +--- + +# Attaching a physical server to a network + +- [Summary](#summary) +- [Motivation](#motivation) + - [Goals](#goals) + - [Non-goals](#non-goals) +- [What exists today and what this proposes](#what-exists-today-and-what-this-proposes) +- [Proposal](#proposal) + - [What it feels like](#what-it-feels-like) + - [User stories](#user-stories) +- [Design details](#design-details) + - [The Physical attachment mode](#the-physical-attachment-mode) + - [The attachment point](#the-attachment-point) + - [A private segment for one server](#a-private-segment-for-one-server) + - [Where a physical claim lives](#where-a-physical-claim-lives) + - [Who may write a physical claim](#who-may-write-a-physical-claim) + - [One project holds a switch port at a time](#one-project-holds-a-switch-port-at-a-time) + - [Handing a server from the boot network to a customer](#handing-a-server-from-the-boot-network-to-a-customer) + - [The boot network](#the-boot-network) + - [Releasing a claim, and proving it](#releasing-a-claim-and-proving-it) + - [The physical realizer](#the-physical-realizer) + - [Conditions a physical claim reports](#conditions-a-physical-claim-reports) +- [Failure and recovery](#failure-and-recovery) +- [Delivery](#delivery) +- [Decisions for a person](#decisions-for-a-person) +- [Drawbacks](#drawbacks) +- [Alternatives](#alternatives) +- [Open questions](#open-questions) +- [References](#references) + +## Summary + +A bare-metal server has no node agent, no container and no hypervisor. Its NIC +reaches a network through the switch port it is cabled to. NSO can attach a +container or a virtual machine to a network today, but it has no way to attach a +physical NIC. + +This proposes a `Physical` attachment mode for the `NetworkInterfaceClaim`. A +physical claim names the NIC and the switch port it is cabled to. NSO assigns +its addresses through IPAM as it does for every claim, and a physical realizer +adds the switch port to the network. + +The same mode serves two kinds of network: + +- **Customer networks.** A server handed to a customer joins the networks the + customer asked for. +- **The boot network.** A provider-owned network that servers join while they + are installed or wiped. + +Four rules keep a switch port safe. Only the provider can write a physical +claim. One project holds a port at a time, so moving a server from the boot +network to a customer is one change that NSO puts in order. A port leaves its +network before NSO frees its addresses. NSO deletes a claim only once IPAM no +longer holds any of its addresses. + +Everything in this document is proposed. Nothing in it is implemented yet. The +[next section](#what-exists-today-and-what-this-proposes) separates the two. + +This document is written for Fleet, which manages physical servers and writes +physical claims, for the Networking team, which owns the switches, and for +NSO, which fulfills the claims. + +## Motivation + +Fleet allocates physical servers to customers. Its +[server networking proposal](https://github.com/datum-cloud/fleet/pull/186) and +its [Machine attachment work](https://github.com/datum-cloud/fleet/pull/198) +call NSO for one interface per Machine interface, and both stop at the same +gap. NSO's attachment modes all describe a NIC handed to a workload on a node, +and a physical server has no node. + +Fleet asks NSO for four things: + +1. A `Physical` attachment mode. +2. An attachment point on the claim: the NIC's MAC address and the switch and + port it is cabled to, which Fleet reads from its Device inventory. +3. Claims that only the provider can place, never the customer. +4. A physical realizer that programs the switch port. + +A server also needs a network while it is being installed or wiped, before any +customer holds it. Fleet's proposal serves that boot network from a site DHCP +service with addresses taken from IPAM directly. Making the boot network an +NSO network instead gives the boot network and customer networks one attachment +model, one writer for each switch port, and one way to release an address. + +### Goals + +- Attach a physical server's NIC, through its switch port, to a customer + network or to the boot network, with the same claim. +- Let only the provider create a physical claim or name a switch port. +- Keep one writer for each switch port's network membership. +- Move a server from the boot network to a customer's networks in one change, + with the port detached from the boot network before it joins a customer's. +- Optionally give a server its own private segment of a network, so it reaches + the network's gateway and no other server. +- Assign every address, boot or customer, through IPAM, through NSO. +- Give a claim a lifetime its writer controls, and delete a claim only once both + the claim's addresses and their IPAM allocations are gone. + +### Non-goals + +- **Configuring the server's operating system.** NSO reports addresses, gateway + and MTU. Fleet delivers them to the server. +- **Serving DHCP or network boot.** NSO assigns the boot address. Whatever + answers firmware on the boot network is Fleet's, as its proposal describes. +- **Choosing a segment identifier.** How a network maps to a VLAN or another + switch-level segment at a site is the realizer's business. +- **A switch port's base profile.** Speed, bonding, the native VLAN, spanning + tree and LLDP stay with network operations. +- **Changing a running server's networks.** As in Fleet's proposal, a server's + interfaces are fixed for the life of its allocation. +- **Retiring the other modes.** `Netns`, `Hypervisor` and `HypervisorDeclared` + are unchanged. + +## What exists today and what this proposes + +| Piece | Today | Proposed here | +|---|---|---| +| `NetworkInterfaceClaim` and `NetworkInterface` | Implemented. Compute writes claims in a location's cell. NSO allocates through IPAM and binds an interface. | Unchanged for existing modes. | +| Attachment modes | `Netns`, `Hypervisor`, `HypervisorDeclared` | Adds `Physical`. | +| Attachment point | None | NIC MAC address, switch, and port, on the claim and its interface. | +| Private segment | None | An optional `isolation: Private` on a physical claim. | +| Who may create a claim | Anyone who can write claims in the cell | Only configured provider identities may write a physical claim. | +| Switch port ownership | None | One project holds a port at a time. Other projects' claims for it wait. | +| Detach before release | None | A physical claim keeps its addresses until the realizer reports the port detached. | +| Deleting a claim | NSO deletes the IPAM claims and removes its finalizer without reading them back. | NSO removes its finalizer only once a read finds each IPAM claim gone and no IPAM allocation naming it. This applies to every mode. | +| Physical realizer | None | A contract the realizer follows, and a test realizer NSO ships with no real switch behind it. | + +## Proposal + +### What it feels like + +Fleet hands a server to a customer whose project has a network named `app`. +It writes one claim in the customer project's namespace, in the cell that +serves the server's location: + +```yaml +apiVersion: networking.datumapis.com/v1alpha +kind: NetworkInterfaceClaim +metadata: + # Fleet derives the name from the allocation and the interface, so a Fleet + # restart finds the same claim. + name: fleet-alloc-3b9d61c2-data + labels: + fleet.datumapis.com/allocation: alloc-3b9d61c2 +spec: + network: + name: app + interfaceName: data + attachmentMode: Physical + attachmentPoint: + macAddress: "02:00:5e:10:00:01" + switch: rack-a1-tor-1 + port: Ethernet12 + ipFamilies: + - IPv4 + reclaimPolicy: Delete +``` + +NSO binds it as it binds any claim, and the claim reports the answer: + +```yaml +status: + networkInterfaceRef: + name: fleet-alloc-3b9d61c2-data + addresses: + - family: IPv4 + address: 192.0.2.10/24 + gateway: 192.0.2.1 + primary: true + conditions: + - type: Bound status: "True" + - type: Allocated status: "True" + - type: Prepared status: "True" + - type: Programmed status: "True" + - type: Ready status: "True" +``` + +The bound `NetworkInterface` carries the same attachment point, so the physical +realizer reads one object to know which port to add to which network. A +customer reading their interfaces through the project never sees the switch or +the port. NSO already leaves cell-only fields out of the copy it publishes to +the project, and the attachment point is one of them. + +A server being installed joins the boot network the same way. The claim lives +in the provider project's namespace and names the provider's boot network: + +```yaml +apiVersion: networking.datumapis.com/v1alpha +kind: NetworkInterfaceClaim +metadata: + # Named from the install operation, so the claim lives exactly as long as + # the operation needs it. + name: alloc-3b9d61c2-install-1-boot +spec: + network: + name: boot + interfaceName: boot + attachmentMode: Physical + attachmentPoint: + macAddress: "02:00:5e:10:00:00" + switch: rack-a1-tor-1 + port: Ethernet11 + isolation: Private + ipFamilies: + - IPv4 + reclaimPolicy: Delete +``` + +### User stories + +- **A customer's server joins two networks.** Fleet writes two claims. Each + binds, the realizer adds each port to its network, and both report `Ready`. +- **A customer cannot attach a port.** A customer, or compute on a customer's + behalf, writes a claim with `attachmentMode: Physical`. Admission refuses it, + and nothing is allocated. +- **A server moves from the boot network to a customer.** Fleet deletes the boot + claim and writes the customer's claims in the same pass. The customer's + claims wait until the port has left the boot network and its boot address is + released, then bind. +- **A wipe is isolated.** A server being wiped joins the boot network on a + private segment and can reach the boot network's gateway, but no other server + on it. +- **A boot address lives as long as one install.** Fleet creates the claim + before the install and deletes it after. Fleet treats the address as released + once the claim is gone, and by then IPAM holds nothing for it. +- **A switch is unreachable.** The realizer cannot detach a port. The claim + stays, its addresses stay held, and the server stays out of use until the + port is detached. + +## Design details + +### The Physical attachment mode + +`attachmentMode` already says how the guest consumes an interface. `Physical` +means the interface is a physical NIC that reaches its network through a switch +port. There is no node, no container and no hypervisor, and nothing on the host +configures it on the platform's behalf. + +As with the other modes, NSO copies `attachmentMode` to the interface and +never interprets it to allocate addresses. A physical claim is addressed +exactly like any other. The mode changes three things NSO does: + +- NSO requires an attachment point, and lets only provider identities write the + claim. +- NSO lets one project hold a switch port at a time. +- NSO waits for the realizer to detach the port before it releases the claim's + addresses. + +The mode stays immutable, like every other field the interface is built on. + +### The attachment point + +```yaml +spec: + attachmentPoint: + # The NIC's MAC address, from the provider's inventory. Six colon-separated + # hexadecimal pairs. + macAddress: "02:00:5e:10:00:01" + # The switch and port the NIC is cabled to, in the names network operations + # uses for them. + switch: rack-a1-tor-1 + port: Ethernet12 +``` + +- A physical claim requires all three fields. A claim in any other mode may not + carry an attachment point. +- The attachment point is immutable. A server recabled to another port gets a + new claim. +- NSO copies it verbatim to the bound interface. NSO does not check it against + any inventory. The provider identity that wrote the claim is trusted for it, + which is why only provider identities may write one. +- NSO leaves it out of the interface copy published to the project. + +The new fields have no server-side defaults. A writer that compares the claim it +reads back with the claim it wrote, as Fleet does, sees no field it did not set. + +### A private segment for one server + +```yaml +spec: + isolation: Private +``` + +`isolation` is optional and only valid on a physical claim. Left unset, the +port joins the network's shared segment and the server can reach every other +member of the network. + +`Private` asks the realizer to put the port in a segment of its own on the +network. The server reaches the network's gateway and nothing else on the +network. Its address still comes from the network's subnet, so the boot network +keeps one address space whether its members are isolated or not. + +How the realizer builds a private segment is its own choice. A private VLAN with +isolated ports, a VLAN per port, or a filter on the port all satisfy the +contract. A realizer that cannot build one reports the claim `Prepared=False` +with a reason, and never attaches the port to the shared segment in its place. + +### Where a physical claim lives + +A physical claim lives where compute's claims live today: in the cell that +serves the server's location, in the namespace of the project whose network it +names. + +| Network | Namespace | +|---|---| +| A customer's network | The customer project's namespace in the cell | +| The boot network | The provider project's namespace in the cell | + +Customers cannot write in a cell at all, which is the first half of keeping +claim placement with the provider. The admission rule below is the second half, +and it holds even against an identity that can write in the cell. + +The namespace is what ties a claim to a project. A claim always names a network +in its own namespace, so a provider writing in a customer's namespace can only +attach to that customer's networks, and a boot claim can only attach to the +provider's. + +Fleet's [current adapter](https://github.com/datum-cloud/fleet/pull/198) writes +claims to the API that holds the customer's Networks rather than to a cell. +Moving it is listed under [Decisions for a person](#decisions-for-a-person). + +### Who may write a physical claim + +An admission rule in each cell refuses any request that creates a claim with +`attachmentMode: Physical`, `attachmentPoint`, or `isolation`, unless the +requester is one of a configured list of provider identities. The list is cell +configuration, and Fleet's identity is the only expected entry. + +Compute, and anything else that writes claims today, is not on the list. A +claim compute writes in any other mode is admitted exactly as it is today. + +The admission rule checks the authenticated requester, which is the only +identity it can trust. It does not record that identity on the claim. + +A second rule protects the detach step. Only the realizer's configured +identity may remove the detach finalizer described +[below](#releasing-a-claim-and-proving-it). Anyone else's update that removes +it is refused. + +### One project holds a switch port at a time + +A switch port can carry several networks, for example a customer's two networks +as two VLANs on one NIC. Those networks must all belong to one project. A port +shared between two projects would let one project's traffic reach the other's. + +NSO keeps one record per switch port in each cell, named from the switch and +port. The record names the project that holds the port as a typed reference: + +```yaml +consumerRef: + apiGroup: resourcemanager.miloapis.com + kind: Project + name: customer-example +``` + +A physical claim binds only once its project holds the port: + +- If no project holds it, NSO creates the record for the claim's project. Only + one create of a given name can succeed, so two projects racing for a port + cannot both win. +- If the claim's own project holds it, the claim binds. +- If another project holds it, the claim reports `Bound=False` with reason + `AttachmentPointHeld`, naming nothing about the other project. It allocates + no address while it waits. + +NSO deletes the record once no claim of the holding project names the port, +which is only after the realizer has detached every one of them. A waiting claim +from another project then takes the port. + +### Handing a server from the boot network to a customer + +Handing a server over is one change from the provider's side. In one pass, +Fleet deletes the server's boot claim and writes the customer's claims. NSO +does the rest in order: + +1. The boot claim reports it is releasing. The realizer removes the port from + the boot network and removes the detach finalizer. +2. NSO releases the boot address and confirms IPAM no longer holds it. The boot + claim is deleted, and with it the provider project's hold on the port. +3. The customer's claims, which waited with `AttachmentPointHeld`, take the + port, allocate their addresses and bind. +4. The realizer adds the port to the customer's networks and reports each claim + `Programmed`. + +The port is never in both projects' networks at once, and the realizer is the +only thing that changes its membership. The reverse trip, from a customer back +to the boot network for a wipe, is the same four steps with the projects +swapped. + +### The boot network + +The boot network is an ordinary NSO `Network` in the provider project. It +reaches each location that has servers the way any network does, and its +subnet in a location provides the gateway servers boot through. + +- **Addresses.** A boot claim's addresses come from IPAM through NSO, like any + claim's. The provider chooses the boot network's address families. Firmware + usually needs IPv4. +- **Lifetime.** The provider names a boot claim from the operation it serves, + creates it before the operation starts and deletes it when the operation ends. + NSO adds no lifetime of its own. +- **Isolation.** The provider sets `isolation: Private` on a boot claim to keep + the server away from the others on the boot network. Leaving it unset shares + the segment. +- **Serving firmware.** NSO hands out the address and the gateway. Whatever + answers firmware's DHCP request with that address is the provider's. + +### Releasing a claim, and proving it + +A provider that deletes a claim needs to know when the addresses are free and +the port is detached. The claim's absence is that signal. NSO keeps the claim +until both are true. + +When a physical claim is created, NSO adds two finalizers: its own, and a detach +finalizer the realizer owns. When the claim is deleted: + +1. NSO marks the claim releasing, so `Prepared` and `Ready` go false. +2. The realizer removes the port from the claim's network, or confirms it was + never added, and removes the detach finalizer. +3. NSO releases the addresses. Under `Delete` it deletes the interface and the + IPAM claims behind it. Under `Retain` it unbinds the interface, which keeps + its addresses and stays detached until a claim of the same name binds it + again. +4. Under `Delete`, NSO reads each IPAM claim back and lists IPAM's allocations. + It removes its own finalizer only once every IPAM claim is gone and no + allocation names one. Until then the claim stays, reporting why. + +NSO never releases an address while the detach finalizer is present. A claim +whose realizer never answers therefore stays, with its addresses held, and that +is the intended failure. An address freed while a port might still carry it +could be handed to another server on the same network. + +Step 4 applies to every attachment mode, not only `Physical`. Today NSO deletes +the IPAM claims and removes its finalizer without reading them back, so a claim +can be gone while IPAM still holds an address for it. Holding the claim until +IPAM confirms changes no address and only delays the deletion until IPAM has +finished. + +### The physical realizer + +A realizer is whatever turns an interface into a working attachment. For +physical claims, the realizer programs switch ports. NSO defines what the +realizer reads and writes, and ships a test realizer that follows the same +contract against a simulated switch. + +The realizer: + +- reads `Physical` interfaces in its cell and the claims bound to them; +- works out each port's desired membership from the bound, non-releasing + claims that name it, and their `isolation`; +- changes a port's membership in one place, one port at a time, so it is the + only writer of that membership; +- sets `Prepared` and `Programmed` on the interface, and `status.attachmentRef` + if it has an object to name; +- removes the detach finalizer once a port no longer carries the releasing + claim's network. + +Two rules keep it safe: + +- **Check before attaching.** The realizer reads the claim after changing a + port. If the claim began releasing meanwhile, the realizer removes the + membership it just added before it removes the detach finalizer. +- **Fail closed.** A realizer that cannot reach a switch leaves `Programmed` + false and keeps the detach finalizer. It never removes the finalizer on a + guess. + +How the realizer reaches a switch, and how a network maps to a segment at a +site, belong to the Networking team. The test realizer stands in for both in +NSO's tests and in Fleet's. + +### Conditions a physical claim reports + +A physical claim reports the same five conditions as any claim, with the same +owners: + +| Condition | Written by | Physical meaning | +|---|---|---| +| `Bound` | NSO | The project holds the port and an interface is bound. | +| `Allocated` | NSO | Every requested family holds an address. | +| `Prepared` | Realizer | The realizer accepted the attachment point and can build its segment. | +| `Programmed` | Realizer | The port carries the network. | +| `Ready` | NSO | All four are true. | + +A provider that installs a server waits for `Allocated` to learn the addresses +it delivers, and for `Programmed` to know the port carries them. Unlike a +container, a physical server can be powered on before its port is programmed, +so waiting on `Programmed` is safe here. + +## Failure and recovery + +| Failure | What happens | +|---|---| +| NSO restarts while binding | The port record and the IPAM claims are named from the switch port and the claim, so the next attempt finds them. | +| Two projects claim one port at once | One record create wins. The other claim waits with `AttachmentPointHeld`. | +| The realizer restarts while attaching | It recomputes each port's membership from the claims, and removes any membership whose claim is releasing. | +| The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns. | +| IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | +| IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | +| A claim is deleted and recreated under the same name | The new claim waits for the old one's release to finish, because the old one's finalizers hold the name until then. | + +## Delivery + +Each step is one draft PR, stacked on the one before it, and each ships with +tests for concurrency, authorization, lifecycle and recovery. + +1. **API.** The `Physical` mode, `attachmentPoint` and `isolation` on the claim + and the interface, with their validation, and the attachment point left out + of the project copy. +2. **Admission.** The rule that limits physical claims to provider identities, + and the rule that limits the detach finalizer to the realizer. +3. **Verified release.** NSO keeps every claim until IPAM confirms its addresses + are released. +4. **Port holds and detach.** The per-port record, the wait for another + project's hold, and the detach finalizer. +5. **Test realizer.** The realizer contract against a simulated switch, so Fleet + can test against NSO end to end. + +## Decisions for a person + +- **The realizer that programs real switches.** NSO ships the contract and a + test realizer. Someone on the Networking team must agree to build the real + one against this contract, including how it reaches switches and how a + network maps to a segment at a site. +- **Where Fleet writes claims.** This design places physical claims in the + location's cell, like compute's. Fleet's adapter writes them next to the + customer's Networks today. Fleet and the platform owners must agree on cell + access for Fleet's identity. +- **Which identities are providers.** Each cell's admission rule needs Fleet's + identity, and the realizer's. Someone must name them per environment. +- **Boot addresses through NSO, not IPAM directly.** Fleet's proposal claims + boot addresses from IPAM itself. This design routes them through NSO's boot + network. Fleet must agree to move. +- **Checking the attachment point against Fleet's records.** Fleet's proposal + asks the realizer to check each attachment point against the allocation Fleet + records. This design trusts the provider identity instead. If that check is + still wanted, the realizer needs a contract with Fleet that this document + does not define. +- **Retain on a physical claim.** A retained physical interface keeps its + addresses and is detached. Whether providers need that, or physical claims + should accept only `Delete`, needs a product answer. + +## Drawbacks + +- **A release can be slow, and can stall.** Deleting a physical claim now waits + on a switch and on IPAM. A switch outage holds addresses and servers until it + clears. +- **Every mode's deletion now waits on IPAM.** Deleting a compute claim takes + one more IPAM read before it completes. +- **One more record per port.** Each attached port costs a record in the cell + for as long as it is attached. +- **The attachment point is trusted.** A provider identity that writes a wrong + port attaches the wrong server. The admission rule narrows who can make that + mistake, but it cannot catch the mistake. + +## Alternatives + +- **Fleet programs the switch ports itself.** Rejected, as in Fleet's proposal. + Fleet would hold switch credentials and write the network owner's systems. +- **A separate `PhysicalAttachment` kind instead of a mode.** Rejected. It would + repeat the claim's addressing, binding and release, and give providers two + ways to ask for an interface. +- **A handoff object that moves a port from one network to another.** + Rejected. The port record and the detach finalizer already order the move, + and a separate object would be a second writer for the same port. +- **Exclusivity by listing interfaces instead of a record.** Rejected. Two + claims reconciled at once can each list, find the port free, and both bind. + Creating a named record cannot race. +- **Isolation as a property of the network.** Rejected. Fleet wants a private + segment per server on a shared boot network, so the choice belongs to each + attachment. +- **The boot network outside NSO**, as Fleet's proposal describes. Rejected + here because it gives a switch port two writers and two release paths. It + remains Fleet's choice, listed above. + +## Open questions + +- **Bonded NICs.** A server whose NICs form an LACP bond reaches a network + through two ports. This design attaches one port per claim. Whether a bond is + one attachment point with two ports, or two claims, should be settled with the + Networking team before bonds are in use. +- **IPv6 on the boot network.** Firmware network boot is mostly IPv4 today. + Whether boot networks should carry IPv6 for operating systems that boot over + it is open. + +## References + +- [Fleet server networking](https://github.com/datum-cloud/fleet/pull/186) + lists what Fleet needs from NSO. +- [Fleet Machine network attachment](https://github.com/datum-cloud/fleet/pull/198) + is Fleet's side of this contract. +- [Fleet's IPAM claim contract](https://github.com/datum-cloud/fleet/pull/216) + shows the per-operation lifetime and verified release Fleet relies on. +- [A network interface a workload can be handed](network-interfaces.md) defines + the claim and interface this extends. From 1693e04ac2a8e1c6dd3832a44209127410c1045e Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 19:59:39 -0600 Subject: [PATCH 02/11] docs: Close races in the physical attachment design Review found that a claim waiting for a port could never be deleted, and that releasing a port hold raced with a new bind. The design now orders binding and release step by step and writes holds by compare-and-swap. Key changes: - name the SwitchPortHold, its holders list, draining, and hash name - let NSO remove the detach finalizer when no interface was bound - add finalizers before taking a hold; the realizer ignores others - scope verified release to physical claims; all modes is a decision - add break-glass removal, update coverage, and the Programmed exception - use RFC 7042 documentation MACs and valid condition YAML Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 453 +++++++++++++++-------- 1 file changed, 294 insertions(+), 159 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index a5e68dd6..e43bfd5a 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -21,9 +21,10 @@ latest-milestone: "v0.x" - [Where a physical claim lives](#where-a-physical-claim-lives) - [Who may write a physical claim](#who-may-write-a-physical-claim) - [One project holds a switch port at a time](#one-project-holds-a-switch-port-at-a-time) + - [Binding a physical claim, in order](#binding-a-physical-claim-in-order) + - [Releasing a physical claim, and proving it](#releasing-a-physical-claim-and-proving-it) - [Handing a server from the boot network to a customer](#handing-a-server-from-the-boot-network-to-a-customer) - [The boot network](#the-boot-network) - - [Releasing a claim, and proving it](#releasing-a-claim-and-proving-it) - [The physical realizer](#the-physical-realizer) - [Conditions a physical claim reports](#conditions-a-physical-claim-reports) - [Failure and recovery](#failure-and-recovery) @@ -53,11 +54,14 @@ The same mode serves two kinds of network: - **The boot network.** A provider-owned network that servers join while they are installed or wiped. -Four rules keep a switch port safe. Only the provider can write a physical -claim. One project holds a port at a time, so moving a server from the boot -network to a customer is one change that NSO puts in order. A port leaves its -network before NSO frees its addresses. NSO deletes a claim only once IPAM no -longer holds any of its addresses. +Four rules keep a switch port safe: + +- Only the provider can write a physical claim. +- One project holds a port at a time. Moving a server from the boot network to + a customer is one change by the provider, and NSO puts its steps in order. +- A port leaves its network before NSO frees its addresses. +- NSO deletes a physical claim only once IPAM no longer holds any of its + addresses. Everything in this document is proposed. Nothing in it is implemented yet. The [next section](#what-exists-today-and-what-this-proposes) separates the two. @@ -100,8 +104,8 @@ model, one writer for each switch port, and one way to release an address. - Optionally give a server its own private segment of a network, so it reaches the network's gateway and no other server. - Assign every address, boot or customer, through IPAM, through NSO. -- Give a claim a lifetime its writer controls, and delete a claim only once both - the claim's addresses and their IPAM allocations are gone. +- Give a claim a lifetime its writer controls, and delete a physical claim only + once both its IPAM claims and their IPAM allocations are gone. ### Non-goals @@ -115,8 +119,8 @@ model, one writer for each switch port, and one way to release an address. tree and LLDP stay with network operations. - **Changing a running server's networks.** As in Fleet's proposal, a server's interfaces are fixed for the life of its allocation. -- **Retiring the other modes.** `Netns`, `Hypervisor` and `HypervisorDeclared` - are unchanged. +- **Changing the other modes.** `Netns`, `Hypervisor` and `HypervisorDeclared` + keep their current behavior, including how their claims are deleted. ## What exists today and what this proposes @@ -127,9 +131,10 @@ model, one writer for each switch port, and one way to release an address. | Attachment point | None | NIC MAC address, switch, and port, on the claim and its interface. | | Private segment | None | An optional `isolation: Private` on a physical claim. | | Who may create a claim | Anyone who can write claims in the cell | Only configured provider identities may write a physical claim. | -| Switch port ownership | None | One project holds a port at a time. Other projects' claims for it wait. | +| Switch port ownership | None | A `SwitchPortHold` per port names the one project that holds it. | | Detach before release | None | A physical claim keeps its addresses until the realizer reports the port detached. | -| Deleting a claim | NSO deletes the IPAM claims and removes its finalizer without reading them back. | NSO removes its finalizer only once a read finds each IPAM claim gone and no IPAM allocation naming it. This applies to every mode. | +| Deleting a claim | NSO finds each IPAM claim, deletes it, and removes its own finalizer. It does not read the IPAM claim again after the delete. | For physical claims, NSO removes its finalizer only once a read finds each IPAM claim gone and no IPAM allocation naming it. Other modes are unchanged. | +| Copy of the interface in the project | An allow-list of fields. It omits `attachmentMode`. | Stays an allow-list. The attachment point and isolation stay off it. | | Physical realizer | None | A contract the realizer follows, and a test realizer NSO ships with no real switch behind it. | ## Proposal @@ -144,49 +149,60 @@ serves the server's location: apiVersion: networking.datumapis.com/v1alpha kind: NetworkInterfaceClaim metadata: - # Fleet derives the name from the allocation and the interface, so a Fleet - # restart finds the same claim. - name: fleet-alloc-3b9d61c2-data + # Fleet derives the name from a hash of the allocation and the interface, + # so a Fleet restart finds the same claim. + name: fleet-5d2c0e7a91b4f3c86e0d1a2b3c4d5e6f7a8b9c0d labels: fleet.datumapis.com/allocation: alloc-3b9d61c2 + fleet.datumapis.com/machine-uid: 0f8e6a52-1c3d-4b7a-9e21-6d5c4b3a2f10 spec: network: name: app interfaceName: data attachmentMode: Physical attachmentPoint: - macAddress: "02:00:5e:10:00:01" + macAddress: "00:00:5e:00:53:01" switch: rack-a1-tor-1 - port: Ethernet12 + port: Ethernet1/12 ipFamilies: - IPv4 reclaimPolicy: Delete ``` +The Machine UID in the label is Fleet's, on Fleet's own label. Nothing in the +claim's spec names an object by UID. + NSO binds it as it binds any claim, and the claim reports the answer: ```yaml status: networkInterfaceRef: - name: fleet-alloc-3b9d61c2-data + name: fleet-5d2c0e7a91b4f3c86e0d1a2b3c4d5e6f7a8b9c0d addresses: - family: IPv4 address: 192.0.2.10/24 gateway: 192.0.2.1 primary: true conditions: - - type: Bound status: "True" - - type: Allocated status: "True" - - type: Prepared status: "True" - - type: Programmed status: "True" - - type: Ready status: "True" + - type: Bound + status: "True" + - type: Allocated + status: "True" + - type: Prepared + status: "True" + - type: Programmed + status: "True" + - type: Ready + status: "True" ``` The bound `NetworkInterface` carries the same attachment point, so the physical -realizer reads one object to know which port to add to which network. A -customer reading their interfaces through the project never sees the switch or -the port. NSO already leaves cell-only fields out of the copy it publishes to -the project, and the attachment point is one of them. +realizer reads one object to know which port to add to which network. + +A customer reading their interfaces through their project sees addresses, +gateway and MTU, but never the switch or the port. NSO publishes that copy from +an allow-list of fields, and this design leaves the attachment point and +isolation off the list. A server being installed joins the boot network the same way. The claim lives in the provider project's namespace and names the provider's boot network: @@ -204,9 +220,9 @@ spec: interfaceName: boot attachmentMode: Physical attachmentPoint: - macAddress: "02:00:5e:10:00:00" + macAddress: "00:00:5e:00:53:00" switch: rack-a1-tor-1 - port: Ethernet11 + port: Ethernet1/11 isolation: Private ipFamilies: - IPv4 @@ -245,13 +261,14 @@ configures it on the platform's behalf. As with the other modes, NSO copies `attachmentMode` to the interface and never interprets it to allocate addresses. A physical claim is addressed -exactly like any other. The mode changes three things NSO does: +exactly like any other. The mode changes four things NSO does: - NSO requires an attachment point, and lets only provider identities write the claim. - NSO lets one project hold a switch port at a time. - NSO waits for the realizer to detach the port before it releases the claim's addresses. +- NSO deletes the claim only once IPAM confirms its addresses are released. The mode stays immutable, like every other field the interface is built on. @@ -262,21 +279,22 @@ spec: attachmentPoint: # The NIC's MAC address, from the provider's inventory. Six colon-separated # hexadecimal pairs. - macAddress: "02:00:5e:10:00:01" + macAddress: "00:00:5e:00:53:01" # The switch and port the NIC is cabled to, in the names network operations - # uses for them. + # uses for them. Either may contain characters a Kubernetes name cannot, + # such as the slash in Ethernet1/12. switch: rack-a1-tor-1 - port: Ethernet12 + port: Ethernet1/12 ``` - A physical claim requires all three fields. A claim in any other mode may not carry an attachment point. -- The attachment point is immutable. A server recabled to another port gets a - new claim. +- The attachment point is immutable. It cannot be set, changed or cleared after + the claim is created. A server recabled to another port gets a new claim. - NSO copies it verbatim to the bound interface. NSO does not check it against any inventory. The provider identity that wrote the claim is trusted for it, which is why only provider identities may write one. -- NSO leaves it out of the interface copy published to the project. +- The interface copy NSO publishes to the project never carries it. The new fields have no server-side defaults. A writer that compares the claim it reads back with the claim it wrote, as Fleet does, sees no field it did not set. @@ -288,9 +306,9 @@ spec: isolation: Private ``` -`isolation` is optional and only valid on a physical claim. Left unset, the -port joins the network's shared segment and the server can reach every other -member of the network. +`isolation` is optional, immutable, and only valid on a physical claim. Left +unset, the port joins the network's shared segment and the server can reach +every other member of the network. `Private` asks the realizer to put the port in a segment of its own on the network. The server reaches the network's gateway and nothing else on the @@ -322,27 +340,41 @@ in its own namespace, so a provider writing in a customer's namespace can only attach to that customer's networks, and a boot claim can only attach to the provider's. -Fleet's [current adapter](https://github.com/datum-cloud/fleet/pull/198) writes -claims to the API that holds the customer's Networks rather than to a cell. -Moving it is listed under [Decisions for a person](#decisions-for-a-person). +Fleet's [current adapter](https://github.com/datum-cloud/fleet/pull/198) uses +one client for the customer's Networks and for its claims, and writes claims +next to the Networks. Under this design Fleet would read Networks where it does +today and write claims in the cell, which takes a second client and write +access in each cell. That is listed under +[Decisions for a person](#decisions-for-a-person). ### Who may write a physical claim -An admission rule in each cell refuses any request that creates a claim with -`attachmentMode: Physical`, `attachmentPoint`, or `isolation`, unless the -requester is one of a configured list of provider identities. The list is cell -configuration, and Fleet's identity is the only expected entry. +An admission rule in each cell covers every create and update of a claim, +including patches. It refuses the request when the claim, before or after the +change, has `attachmentMode: Physical`, an `attachmentPoint`, or an +`isolation`, unless the requester is one of a configured list of provider +identities. The list is cell configuration, and Fleet's identity is the +expected entry. Compute, and anything else that writes claims today, is not on the list. A claim compute writes in any other mode is admitted exactly as it is today. -The admission rule checks the authenticated requester, which is the only -identity it can trust. It does not record that identity on the claim. +The rule checks the authenticated requester, which is the only identity it can +trust. It does not record that identity on the claim. + +NSO's own identity is exempt, because NSO writes finalizers and status on every +claim. + +A second rule protects the detach step. Only three kinds of identity may remove +the detach finalizer described +[below](#releasing-a-physical-claim-and-proving-it): -A second rule protects the detach step. Only the realizer's configured -identity may remove the detach finalizer described -[below](#releasing-a-claim-and-proving-it). Anyone else's update that removes -it is refused. +- the realizer's configured identity; +- NSO's own identity, for a claim that never had an interface; and +- a configured break-glass group of operators. + +An operator in the break-glass group uses it only after confirming on the +switch that the port no longer carries the network. NSO's runbook will say how. ### One project holds a switch port at a time @@ -350,49 +382,164 @@ A switch port can carry several networks, for example a customer's two networks as two VLANs on one NIC. Those networks must all belong to one project. A port shared between two projects would let one project's traffic reach the other's. -NSO keeps one record per switch port in each cell, named from the switch and -port. The record names the project that holds the port as a typed reference: +NSO records which project holds each port in a `SwitchPortHold`: a +cluster-scoped object in the cell. NSO is its only writer. ```yaml -consumerRef: - apiGroup: resourcemanager.miloapis.com - kind: Project - name: customer-example +apiVersion: networking.datumapis.com/v1alpha +kind: SwitchPortHold +metadata: + # A hash of the switch and port, because port names can hold characters a + # Kubernetes name cannot, and joining the two strings could collide. + name: port-9c4e1f0b7a2d5e8c3b6a9f0e1d2c3b4a5f6e7d8c +spec: + # The switch and port, stored in full. A hold whose stored pair differs from + # a claim's is a hash collision, and NSO refuses the claim. + switch: rack-a1-tor-1 + port: Ethernet1/12 + # The project holding the port. + consumerRef: + apiGroup: resourcemanager.miloapis.com + kind: Project + name: customer-example + # Every claim of that project bound to the port, by namespace and name. + holders: + - namespace: ns-customer-example + name: fleet-5d2c0e7a91b4f3c86e0d1a2b3c4d5e6f7a8b9c0d + # Set once another project's claim is waiting for the port. + draining: false ``` -A physical claim binds only once its project holds the port: +NSO reads the project for `consumerRef` from the claim's namespace, the same +way it finds the project when it allocates addresses today. + +Every change to a hold is a compare-and-swap. NSO reads the hold, changes it, +and writes it back. If another writer changed the hold in between, the write +fails and NSO reads it again. That makes each of these exact under concurrency: + +- **Taking a free port.** NSO creates the hold with the claim as its only + holder. Only one create of a given name can succeed, so two projects racing + for a port cannot both win. +- **Joining a held port.** A claim of the holding project adds itself to + `holders`, unless the hold is draining. +- **Leaving a port.** A releasing claim removes itself from `holders`. When the + list becomes empty, NSO deletes the hold, on the condition that nobody has + changed it since NSO read it. A claim that joined in between makes the delete + fail, and the hold stays. +- **Waiting for a port.** A claim of another project sets `draining` and reports + `Bound=False` with reason `AttachmentPointHeld`. It allocates no address while + it waits, and its message names nothing about the other project. + +A draining hold admits no new holders, so the holding project cannot keep a +waiting project out by adding claims. Once the last holder leaves, the hold is +deleted and the next waiting claim creates its own. When several projects wait +at once, the first create wins and the others keep waiting. Fleet allocates a +server to one customer at a time, so several waiting projects mean something +upstream is already wrong. + +A port carries a network at most once. A second claim for the same port and the +same network waits, with reason `AttachmentPointHeld`, until the first is +released. That is what happens when a wipe's boot claim is written while the +install's boot claim is still releasing. + +A holder that never becomes ready keeps the hold. A waiting claim's reason does +not say who holds the port, because the waiting claim may belong to another +customer. The provider can read the hold itself, in the cell, to see which +claims hold it. + +### Binding a physical claim, in order + +NSO binds a physical claim in these steps. Each one starts only after the +previous one is written: + +1. NSO adds its own finalizer and the detach finalizer in one update. A claim + deleted before this update completes has neither, takes nothing, and is + deleted at once. +2. NSO takes or joins the port's hold. +3. NSO allocates the addresses through IPAM. +4. NSO creates or binds the interface, copying the attachment point and + isolation. +5. NSO reports the claim `Bound` and `Allocated`. + +Kubernetes refuses a new finalizer on an object that is being deleted, so step 1 +can never add the detach finalizer to a claim that is already releasing. The +realizer never acts on a claim that lacks the detach finalizer, which closes +the other half of that race. + +### Releasing a physical claim, and proving it + +A provider that deletes a claim needs to know when the addresses are free and +the port is detached. The claim's absence is that signal. NSO keeps the claim +until both are true. + +When a physical claim is deleted: -- If no project holds it, NSO creates the record for the claim's project. Only - one create of a given name can succeed, so two projects racing for a port - cannot both win. -- If the claim's own project holds it, the claim binds. -- If another project holds it, the claim reports `Bound=False` with reason - `AttachmentPointHeld`, naming nothing about the other project. It allocates - no address while it waits. +1. NSO marks the claim releasing, so `Prepared` and `Ready` go false. +2. The detach finalizer comes off. Who removes it depends on whether the claim + ever had an interface: + - If an interface bound to the claim exists, the realizer removes the port + from the claim's network, confirms the port no longer carries it, and + removes the finalizer. + - If no interface bound to the claim exists, the port was never programmed + for it, and NSO removes the finalizer itself. A claim waiting with + `AttachmentPointHeld` is in this case. +3. NSO releases the addresses. Under `Delete` it deletes the interface and the + IPAM claims behind it. Under `Retain` it unbinds the interface, which keeps + its addresses and stays detached until a claim of the same name binds it + again. +4. Under `Delete`, NSO reads each IPAM claim again, and lists the IPAM + allocations in the same IPAM namespace. The release is verified once each + IPAM claim is gone and no allocation's `spec.claimRef` names one. Under + `Retain`, IPAM keeps the allocations on purpose, so the release is verified + once the interface is unbound. +5. NSO leaves the port's hold. +6. NSO removes its own finalizer, and the claim is gone. -NSO deletes the record once no claim of the holding project names the port, -which is only after the realizer has detached every one of them. A waiting claim -from another project then takes the port. +Until each step completes, the claim stays and its conditions say which step it +is waiting on. + +NSO never releases an address while the detach finalizer is present. A claim +whose realizer never answers therefore stays, with its addresses held, and that +is the intended failure. An address freed while a port might still carry it +could be handed to another server on the same network. + +The claim's name stays taken until step 6. A create under the same name before +then is refused as already existing, and the writer retries once the old claim +is gone. Naming a boot claim from its operation means a new operation never +needs an old operation's name. + +The verified release in step 4 applies to physical claims only. Today, for +every mode, NSO finds each IPAM claim, deletes it, and removes its own +finalizer without reading the IPAM claim again. Extending step 4 to compute's +claims would make every claim's deletion wait on IPAM, including during +namespace and project teardown. That choice is listed under +[Decisions for a person](#decisions-for-a-person). ### Handing a server from the boot network to a customer Handing a server over is one change from the provider's side. In one pass, Fleet deletes the server's boot claim and writes the customer's claims. NSO -does the rest in order: - -1. The boot claim reports it is releasing. The realizer removes the port from - the boot network and removes the detach finalizer. -2. NSO releases the boot address and confirms IPAM no longer holds it. The boot - claim is deleted, and with it the provider project's hold on the port. -3. The customer's claims, which waited with `AttachmentPointHeld`, take the - port, allocate their addresses and bind. -4. The realizer adds the port to the customer's networks and reports each claim +puts the rest in order: + +1. The customer's claims find the port held by the provider project. They mark + the hold draining and wait with `AttachmentPointHeld`. +2. The boot claim releases. The realizer removes the port from the boot + network, and NSO releases and verifies the boot address. +3. The boot claim leaves the hold. It was the last holder, so NSO deletes the + hold. +4. The customer's claims take the port, allocate their addresses and bind. +5. The realizer adds the port to the customer's networks and reports each claim `Programmed`. The port is never in both projects' networks at once, and the realizer is the -only thing that changes its membership. The reverse trip, from a customer back -to the boot network for a wipe, is the same four steps with the projects -swapped. +only thing that changes its membership. + +The reverse trip, from a customer back to the boot network for a wipe, follows +the same steps with the projects swapped. Its precondition is that every one of +the customer's claims on the port is deleted. Fleet's proposal also considers a +boot NIC that carries customer networks as tagged VLANs. On such a port, a boot +claim waits behind the customer's hold until the customer's claims are all +gone, which matches Fleet's order of release before wipe. ### The boot network @@ -412,37 +559,6 @@ subnet in a location provides the gateway servers boot through. - **Serving firmware.** NSO hands out the address and the gateway. Whatever answers firmware's DHCP request with that address is the provider's. -### Releasing a claim, and proving it - -A provider that deletes a claim needs to know when the addresses are free and -the port is detached. The claim's absence is that signal. NSO keeps the claim -until both are true. - -When a physical claim is created, NSO adds two finalizers: its own, and a detach -finalizer the realizer owns. When the claim is deleted: - -1. NSO marks the claim releasing, so `Prepared` and `Ready` go false. -2. The realizer removes the port from the claim's network, or confirms it was - never added, and removes the detach finalizer. -3. NSO releases the addresses. Under `Delete` it deletes the interface and the - IPAM claims behind it. Under `Retain` it unbinds the interface, which keeps - its addresses and stays detached until a claim of the same name binds it - again. -4. Under `Delete`, NSO reads each IPAM claim back and lists IPAM's allocations. - It removes its own finalizer only once every IPAM claim is gone and no - allocation names one. Until then the claim stays, reporting why. - -NSO never releases an address while the detach finalizer is present. A claim -whose realizer never answers therefore stays, with its addresses held, and that -is the intended failure. An address freed while a port might still carry it -could be handed to another server on the same network. - -Step 4 applies to every attachment mode, not only `Physical`. Today NSO deletes -the IPAM claims and removes its finalizer without reading them back, so a claim -can be gone while IPAM still holds an address for it. Holding the claim until -IPAM confirms changes no address and only delays the deletion until IPAM has -finished. - ### The physical realizer A realizer is whatever turns an interface into a working attachment. For @@ -453,27 +569,31 @@ contract against a simulated switch. The realizer: - reads `Physical` interfaces in its cell and the claims bound to them; -- works out each port's desired membership from the bound, non-releasing - claims that name it, and their `isolation`; +- counts a claim toward a port's membership only while the claim has no + deletion timestamp and carries the detach finalizer; +- works out each port's desired membership from those claims, their networks + and their `isolation`; - changes a port's membership in one place, one port at a time, so it is the only writer of that membership; -- sets `Prepared` and `Programmed` on the interface, and `status.attachmentRef` - if it has an object to name; -- removes the detach finalizer once a port no longer carries the releasing - claim's network. +- writes `Prepared` and `Programmed` on the interface and on the claim, as the + existing realizer for virtual interfaces does, and `status.attachmentRef` if + it has an object to name; +- removes the detach finalizer from a deleted claim once the port no longer + carries that claim's network. Two rules keep it safe: -- **Check before attaching.** The realizer reads the claim after changing a - port. If the claim began releasing meanwhile, the realizer removes the - membership it just added before it removes the detach finalizer. +- **Check after changing a port.** The realizer reads the claim again after it + changes a port. If the claim has gained a deletion timestamp meanwhile, the + realizer removes the membership it just added before it removes the detach + finalizer. - **Fail closed.** A realizer that cannot reach a switch leaves `Programmed` false and keeps the detach finalizer. It never removes the finalizer on a guess. How the realizer reaches a switch, and how a network maps to a segment at a site, belong to the Networking team. The test realizer stands in for both in -NSO's tests and in Fleet's. +NSO's own tests, and any other team may run it in theirs. ### Conditions a physical claim reports @@ -484,26 +604,34 @@ owners: |---|---|---| | `Bound` | NSO | The project holds the port and an interface is bound. | | `Allocated` | NSO | Every requested family holds an address. | -| `Prepared` | Realizer | The realizer accepted the attachment point and can build its segment. | -| `Programmed` | Realizer | The port carries the network. | -| `Ready` | NSO | All four are true. | +| `Prepared` | Realizer, on the interface and the claim | The realizer accepted the attachment point and can build its segment. | +| `Programmed` | Realizer, on the interface and the claim | The port carries the network. | +| `Ready` | NSO, and the realizer when it writes `Programmed` | All four are true. | + +The [interface design](network-interfaces.md#how-the-guest-consumes-it-and-when-it-is-safe-to-start) +says nothing may gate creating a workload on `Programmed`. That rule exists +because a virtual interface is attached while its workload's sandbox is being +created, so a consumer that waits for `Programmed` first waits forever. -A provider that installs a server waits for `Allocated` to learn the addresses -it delivers, and for `Programmed` to know the port carries them. Unlike a -container, a physical server can be powered on before its port is programmed, -so waiting on `Programmed` is safe here. +A physical port is attached with no workload at all. The realizer programs it +as soon as the claim binds, whether the server is on or off. So a provider may +wait for `Programmed` before installing a server or handing it over, as +Fleet's `NetworkReady` already does. The rule for the other modes stands. ## Failure and recovery | Failure | What happens | |---|---| -| NSO restarts while binding | The port record and the IPAM claims are named from the switch port and the claim, so the next attempt finds them. | -| Two projects claim one port at once | One record create wins. The other claim waits with `AttachmentPointHeld`. | -| The realizer restarts while attaching | It recomputes each port's membership from the claims, and removes any membership whose claim is releasing. | -| The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns. | +| NSO restarts while binding | Each step is written before the next starts, and the hold and IPAM claims are named from the port and the claim, so the next attempt finds them. | +| Two projects claim one port at once | One hold create wins. The other claim waits with `AttachmentPointHeld`. | +| A project binds a claim while its last claim on the port leaves | Both write the hold by compare-and-swap. Either the join lands first and the hold stays, or the delete lands first and the joining claim creates a new hold. | +| A claim is deleted before NSO adds its finalizers | The claim is deleted at once. Nothing was taken for it. | +| A claim waiting for a port is deleted | No interface was bound to it, so NSO removes the detach finalizer itself and the claim is deleted. | +| The realizer restarts while attaching | It recomputes each port's membership from the claims, and removes any membership whose claim has a deletion timestamp. | +| The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or an operator in the break-glass group removes it. | | IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | | IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | -| A claim is deleted and recreated under the same name | The new claim waits for the old one's release to finish, because the old one's finalizers hold the name until then. | +| A claim is recreated under a name whose claim is still releasing | The create is refused as already existing. The writer retries after the old claim is gone. | ## Delivery @@ -511,16 +639,16 @@ Each step is one draft PR, stacked on the one before it, and each ships with tests for concurrency, authorization, lifecycle and recovery. 1. **API.** The `Physical` mode, `attachmentPoint` and `isolation` on the claim - and the interface, with their validation, and the attachment point left out - of the project copy. + and the interface, with their validation and immutability, and a test that + the project copy omits both. 2. **Admission.** The rule that limits physical claims to provider identities, - and the rule that limits the detach finalizer to the realizer. -3. **Verified release.** NSO keeps every claim until IPAM confirms its addresses - are released. -4. **Port holds and detach.** The per-port record, the wait for another - project's hold, and the detach finalizer. -5. **Test realizer.** The realizer contract against a simulated switch, so Fleet - can test against NSO end to end. + and the rule that limits removing the detach finalizer. +3. **Verified release.** NSO keeps a physical claim until IPAM confirms its + addresses are released. +4. **Port holds and detach.** The `SwitchPortHold`, the binding order, the wait + for another project's hold, and the detach finalizer. +5. **Test realizer.** The realizer contract against a simulated switch, so + NSO's tests, and any team's, can run a physical attachment end to end. ## Decisions for a person @@ -530,10 +658,11 @@ tests for concurrency, authorization, lifecycle and recovery. network maps to a segment at a site. - **Where Fleet writes claims.** This design places physical claims in the location's cell, like compute's. Fleet's adapter writes them next to the - customer's Networks today. Fleet and the platform owners must agree on cell - access for Fleet's identity. -- **Which identities are providers.** Each cell's admission rule needs Fleet's - identity, and the realizer's. Someone must name them per environment. + customer's Networks with one client today. Fleet would need a second client + and write access in each cell, and the platform owners must agree to grant + it. +- **Which identities are providers, realizers and break-glass operators.** Each + cell's admission rules need them named, per environment. - **Boot addresses through NSO, not IPAM directly.** Fleet's proposal claims boot addresses from IPAM itself. This design routes them through NSO's boot network. Fleet must agree to move. @@ -545,19 +674,22 @@ tests for concurrency, authorization, lifecycle and recovery. - **Retain on a physical claim.** A retained physical interface keeps its addresses and is detached. Whether providers need that, or physical claims should accept only `Delete`, needs a product answer. +- **Verified release for every mode.** This design verifies release for + physical claims only. Whether compute's claims should also wait for IPAM to + confirm, and with what limit on that wait, needs the compute team's view. ## Drawbacks -- **A release can be slow, and can stall.** Deleting a physical claim now waits - on a switch and on IPAM. A switch outage holds addresses and servers until it - clears. -- **Every mode's deletion now waits on IPAM.** Deleting a compute claim takes - one more IPAM read before it completes. -- **One more record per port.** Each attached port costs a record in the cell - for as long as it is attached. +- **A release can be slow, and can stall.** Deleting a physical claim waits on a + switch and on IPAM. A switch outage holds addresses and servers until it + clears or an operator steps in. +- **One more object per port.** Each attached port costs a `SwitchPortHold` in + the cell for as long as it is attached. - **The attachment point is trusted.** A provider identity that writes a wrong port attaches the wrong server. The admission rule narrows who can make that mistake, but it cannot catch the mistake. +- **A stuck holder blocks the port.** A claim that holds a port and never + becomes ready keeps other projects out until the provider deletes it. ## Alternatives @@ -567,11 +699,14 @@ tests for concurrency, authorization, lifecycle and recovery. repeat the claim's addressing, binding and release, and give providers two ways to ask for an interface. - **A handoff object that moves a port from one network to another.** - Rejected. The port record and the detach finalizer already order the move, - and a separate object would be a second writer for the same port. -- **Exclusivity by listing interfaces instead of a record.** Rejected. Two - claims reconciled at once can each list, find the port free, and both bind. - Creating a named record cannot race. + Rejected. The hold and the detach finalizer already order the move, and a + handoff object would be a second writer for the same port. +- **Exclusivity by listing interfaces instead of a hold.** Rejected. Two claims + reconciled at once can each list, find the port free, and both bind. Writing + one named hold by compare-and-swap cannot race. +- **The detach finalizer on the interface instead of the claim.** Rejected. + Under `Retain` the interface is never deleted, so a finalizer on it would + never be used to signal a detach. - **Isolation as a property of the network.** Rejected. Fleet wants a private segment per server on a shared boot network, so the choice belongs to each attachment. From 16317a2dd2377d6a34128a60090ce9b2eff7c2f8 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:04:01 -0600 Subject: [PATCH 03/11] docs: Align physical attachment with Fleet Fleet's server networking proposal now expects a boot claim per network-booting operation that takes its port while it exists, with the customer's claims bound and allocated underneath. The earlier hold model made customer claims wait for the boot claim to go, which deadlocks an install that needs the customer's addresses first. Key changes: - add purpose: Boot and derive what a port carries from its claims - record boot and network claims on the hold before any interface - decide the detach step from the hold record, not the interface - drop draining and accept unordered waiters as a drawback - give Ready one writer and have the realizer report VLAN tags - compare with Fleet's proposal and say where NSO differs Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 584 ++++++++++++++--------- 1 file changed, 366 insertions(+), 218 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index e43bfd5a..265b2efc 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -17,16 +17,19 @@ latest-milestone: "v0.x" - [Design details](#design-details) - [The Physical attachment mode](#the-physical-attachment-mode) - [The attachment point](#the-attachment-point) + - [Boot claims and network claims](#boot-claims-and-network-claims) + - [What a port carries](#what-a-port-carries) - [A private segment for one server](#a-private-segment-for-one-server) - [Where a physical claim lives](#where-a-physical-claim-lives) - [Who may write a physical claim](#who-may-write-a-physical-claim) - - [One project holds a switch port at a time](#one-project-holds-a-switch-port-at-a-time) + - [The switch port hold](#the-switch-port-hold) - [Binding a physical claim, in order](#binding-a-physical-claim-in-order) - [Releasing a physical claim, and proving it](#releasing-a-physical-claim-and-proving-it) - - [Handing a server from the boot network to a customer](#handing-a-server-from-the-boot-network-to-a-customer) + - [Installing a server and handing it to a customer](#installing-a-server-and-handing-it-to-a-customer) - [The boot network](#the-boot-network) - [The physical realizer](#the-physical-realizer) - [Conditions a physical claim reports](#conditions-a-physical-claim-reports) +- [How this lines up with Fleet's proposal](#how-this-lines-up-with-fleets-proposal) - [Failure and recovery](#failure-and-recovery) - [Delivery](#delivery) - [Decisions for a person](#decisions-for-a-person) @@ -45,23 +48,28 @@ physical NIC. This proposes a `Physical` attachment mode for the `NetworkInterfaceClaim`. A physical claim names the NIC and the switch port it is cabled to. NSO assigns its addresses through IPAM as it does for every claim, and a physical realizer -adds the switch port to the network. +sets which networks the switch port carries. The same mode serves two kinds of network: - **Customer networks.** A server handed to a customer joins the networks the customer asked for. - **The boot network.** A provider-owned network that servers join while they - are installed or wiped. + are installed or wiped. A claim for it is a boot claim. + +A port's networks follow from the claims that name it. While a boot claim names +the port, the port carries the boot network and nothing else. Otherwise it +carries the networks of one project's claims, and with no claims it carries no +network. Four rules keep a switch port safe: - Only the provider can write a physical claim. -- One project holds a port at a time. Moving a server from the boot network to - a customer is one change by the provider, and NSO puts its steps in order. -- A port leaves its network before NSO frees its addresses. -- NSO deletes a physical claim only once IPAM no longer holds any of its - addresses. +- A port carries one project's networks at a time, and the realizer is the only + writer of what it carries. +- A port leaves a network before NSO frees the addresses it carried there. +- Under the `Delete` reclaim policy, NSO deletes a physical claim only once IPAM + holds none of its addresses. Everything in this document is proposed. Nothing in it is implemented yet. The [next section](#what-exists-today-and-what-this-proposes) separates the two. @@ -79,46 +87,50 @@ call NSO for one interface per Machine interface, and both stop at the same gap. NSO's attachment modes all describe a NIC handed to a workload on a node, and a physical server has no node. -Fleet asks NSO for four things: +Fleet asks NSO for: 1. A `Physical` attachment mode. 2. An attachment point on the claim: the NIC's MAC address and the switch and port it is cabled to, which Fleet reads from its Device inventory. -3. Claims that only the provider can place, never the customer. -4. A physical realizer that programs the switch port. +3. A provider-owned boot network, with isolation between the servers on it. +4. A port's networks derived from the claims that name it, with a boot claim + taking the port while it exists. +5. Claims that only the provider can place, never the customer. +6. Detach before delete. +7. Boot addresses served by NSO on the boot network. -A server also needs a network while it is being installed or wiped, before any -customer holds it. Fleet's proposal serves that boot network from a site DHCP -service with addresses taken from IPAM directly. Making the boot network an -NSO network instead gives the boot network and customer networks one attachment -model, one writer for each switch port, and one way to release an address. +[How this lines up with Fleet's proposal](#how-this-lines-up-with-fleets-proposal) +maps each ask to this design, and says where the two differ. ### Goals - Attach a physical server's NIC, through its switch port, to a customer - network or to the boot network, with the same claim. + network or to the boot network, with the same kind of claim. - Let only the provider create a physical claim or name a switch port. -- Keep one writer for each switch port's network membership. -- Move a server from the boot network to a customer's networks in one change, - with the port detached from the boot network before it joins a customer's. +- Make NSO's realizer the one writer of a port's networks, including its + untagged VLAN and its isolation on the boot network. +- Move a port from the boot network to a customer's networks in one change on + the port. - Optionally give a server its own private segment of a network, so it reaches the network's gateway and no other server. - Assign every address, boot or customer, through IPAM, through NSO. -- Give a claim a lifetime its writer controls, and delete a physical claim only - once both its IPAM claims and their IPAM allocations are gone. +- Give a claim a lifetime its writer controls. Under `Delete`, delete a physical + claim only once both its IPAM claims and their IPAM allocations are gone. ### Non-goals -- **Configuring the server's operating system.** NSO reports addresses, gateway - and MTU. Fleet delivers them to the server. -- **Serving DHCP or network boot.** NSO assigns the boot address. Whatever - answers firmware on the boot network is Fleet's, as its proposal describes. -- **Choosing a segment identifier.** How a network maps to a VLAN or another - switch-level segment at a site is the realizer's business. -- **A switch port's base profile.** Speed, bonding, the native VLAN, spanning - tree and LLDP stay with network operations. +- **Configuring the server's operating system.** NSO reports addresses, + gateway, MTU and the VLAN a network arrives on. Fleet delivers them to the + server. +- **Serving DHCP or network boot.** NSO assigns the boot address. DHCP, PXE, + iPXE and the installer stay Fleet's, as its proposal describes. +- **Choosing a segment identifier.** Which VLAN or other switch-level segment + carries a network at a site is the realizer's business. +- **A switch port's base profile.** Speed, bonding, bond fallback, edge mode and + LLDP stay with network operations, as does DHCP snooping on the provisioning + VLAN. - **Changing a running server's networks.** As in Fleet's proposal, a server's - interfaces are fixed for the life of its allocation. + customer interfaces are fixed for the life of its allocation. - **Changing the other modes.** `Netns`, `Hypervisor` and `HypervisorDeclared` keep their current behavior, including how their claims are deleted. @@ -129,19 +141,20 @@ model, one writer for each switch port, and one way to release an address. | `NetworkInterfaceClaim` and `NetworkInterface` | Implemented. Compute writes claims in a location's cell. NSO allocates through IPAM and binds an interface. | Unchanged for existing modes. | | Attachment modes | `Netns`, `Hypervisor`, `HypervisorDeclared` | Adds `Physical`. | | Attachment point | None | NIC MAC address, switch, and port, on the claim and its interface. | +| Boot claims | None | `purpose: Boot` on a physical claim. A boot claim takes its port while it exists. | | Private segment | None | An optional `isolation: Private` on a physical claim. | | Who may create a claim | Anyone who can write claims in the cell | Only configured provider identities may write a physical claim. | -| Switch port ownership | None | A `SwitchPortHold` per port names the one project that holds it. | -| Detach before release | None | A physical claim keeps its addresses until the realizer reports the port detached. | -| Deleting a claim | NSO finds each IPAM claim, deletes it, and removes its own finalizer. It does not read the IPAM claim again after the delete. | For physical claims, NSO removes its finalizer only once a read finds each IPAM claim gone and no IPAM allocation naming it. Other modes are unchanged. | -| Copy of the interface in the project | An allow-list of fields. It omits `attachmentMode`. | Stays an allow-list. The attachment point and isolation stay off it. | +| Switch port ownership | None | A `SwitchPortHold` per port records the boot claim and the one project whose claims hold the port. | +| Detach before release | None | A physical claim keeps its addresses until the realizer reports the port no longer carries its network. | +| Deleting a claim | NSO finds each IPAM claim, deletes it, and removes its own finalizer. It does not read the IPAM claim again after the delete. | For physical claims under `Delete`, NSO removes its finalizer only once a read finds each IPAM claim gone and no IPAM allocation naming it. Other modes are unchanged. | +| Copy of the interface in the project | An allow-list of fields. It omits `attachmentMode`. | Stays an allow-list. The attachment point, purpose and isolation stay off it. | | Physical realizer | None | A contract the realizer follows, and a test realizer NSO ships with no real switch behind it. | ## Proposal ### What it feels like -Fleet hands a server to a customer whose project has a network named `app`. +Fleet allocates a server to a customer whose project has a network named `app`. It writes one claim in the customer project's namespace, in the cell that serves the server's location: @@ -154,7 +167,6 @@ metadata: name: fleet-5d2c0e7a91b4f3c86e0d1a2b3c4d5e6f7a8b9c0d labels: fleet.datumapis.com/allocation: alloc-3b9d61c2 - fleet.datumapis.com/machine-uid: 0f8e6a52-1c3d-4b7a-9e21-6d5c4b3a2f10 spec: network: name: app @@ -169,10 +181,9 @@ spec: reclaimPolicy: Delete ``` -The Machine UID in the label is Fleet's, on Fleet's own label. Nothing in the -claim's spec names an object by UID. - -NSO binds it as it binds any claim, and the claim reports the answer: +NSO binds it as it binds any claim, and the claim reports the answer. While the +server is still being installed on the boot network, the claim is bound and +allocated but not yet programmed: ```yaml status: @@ -191,21 +202,23 @@ status: - type: Prepared status: "True" - type: Programmed - status: "True" + status: "False" + reason: BootAttachmentActive - type: Ready - status: "True" + status: "False" ``` -The bound `NetworkInterface` carries the same attachment point, so the physical -realizer reads one object to know which port to add to which network. +Once the install ends and its boot claim is released, the realizer moves the +port onto `app`, and `Programmed` and `Ready` turn true. -A customer reading their interfaces through their project sees addresses, -gateway and MTU, but never the switch or the port. NSO publishes that copy from -an allow-list of fields, and this design leaves the attachment point and -isolation off the list. +The bound `NetworkInterface` carries the same attachment point, so the realizer +reads one object to know which port to set. A customer reading their interfaces +through their project sees addresses, gateway and MTU, but never the switch or +the port. NSO publishes that copy from an allow-list of fields, and this design +leaves the attachment point, purpose and isolation off the list. -A server being installed joins the boot network the same way. The claim lives -in the provider project's namespace and names the provider's boot network: +The install's boot claim lives in the provider project's namespace and names +the provider's boot network: ```yaml apiVersion: networking.datumapis.com/v1alpha @@ -219,36 +232,41 @@ spec: name: boot interfaceName: boot attachmentMode: Physical + purpose: Boot attachmentPoint: - macAddress: "00:00:5e:00:53:00" + macAddress: "00:00:5e:00:53:01" switch: rack-a1-tor-1 - port: Ethernet1/11 + port: Ethernet1/12 isolation: Private ipFamilies: - IPv4 reclaimPolicy: Delete ``` +Its status carries the boot address, and `Programmed` turns true once the port +carries the boot network untagged. + ### User stories -- **A customer's server joins two networks.** Fleet writes two claims. Each - binds, the realizer adds each port to its network, and both report `Ready`. +- **A server is installed and handed over.** Fleet writes the install's boot + claim and the customer's claims. The port joins the boot network, and the + customer's claims get their addresses so the installer can configure them. + When Fleet deletes the boot claim, the realizer moves the port to the + customer's networks in one change. +- **A customer's server joins two networks.** Fleet writes two claims. Both + report `Ready` once the realizer sets the ports. - **A customer cannot attach a port.** A customer, or compute on a customer's behalf, writes a claim with `attachmentMode: Physical`. Admission refuses it, and nothing is allocated. -- **A server moves from the boot network to a customer.** Fleet deletes the boot - claim and writes the customer's claims in the same pass. The customer's - claims wait until the port has left the boot network and its boot address is - released, then bind. - **A wipe is isolated.** A server being wiped joins the boot network on a private segment and can reach the boot network's gateway, but no other server on it. -- **A boot address lives as long as one install.** Fleet creates the claim +- **A boot address lives as long as one install.** Fleet creates the boot claim before the install and deletes it after. Fleet treats the address as released once the claim is gone, and by then IPAM holds nothing for it. -- **A switch is unreachable.** The realizer cannot detach a port. The claim +- **A switch is unreachable.** The realizer cannot change a port. The claim stays, its addresses stay held, and the server stays out of use until the - port is detached. + port changes or an operator steps in. ## Design details @@ -265,10 +283,11 @@ exactly like any other. The mode changes four things NSO does: - NSO requires an attachment point, and lets only provider identities write the claim. -- NSO lets one project hold a switch port at a time. -- NSO waits for the realizer to detach the port before it releases the claim's - addresses. -- NSO deletes the claim only once IPAM confirms its addresses are released. +- NSO records the claim on the port's hold, which decides what the port carries. +- NSO waits for the realizer to take the claim's network off the port before it + releases the claim's addresses. +- Under `Delete`, NSO deletes the claim only once IPAM confirms its addresses + are released. The mode stays immutable, like every other field the interface is built on. @@ -299,6 +318,46 @@ spec: The new fields have no server-side defaults. A writer that compares the claim it reads back with the claim it wrote, as Fleet does, sees no field it did not set. +### Boot claims and network claims + +A physical claim is one of two kinds: + +- A **boot claim** sets `purpose: Boot`. It attaches the port to a boot network + for as long as the claim exists, ahead of any other claim on the port. +- A **network claim** leaves `purpose` unset. It attaches the port to a network + whenever no boot claim names the port. + +`purpose` is immutable and only valid on a physical claim. Only provider +identities may set it, like everything else on a physical claim. + +NSO does not decide which networks are boot networks. A boot claim may name any +network in its own namespace, and the provider's boot network is the one it +names in practice. That keeps the boot network an ordinary NSO network. + +### What a port carries + +The realizer works out what each port carries from the claims recorded on the +port's hold, counting only claims with no deletion timestamp: + +1. While a boot claim is recorded, the port carries that boot claim's network, + untagged, and nothing else. +2. Otherwise, the port carries the networks of the network claims recorded on + the hold. They all belong to one project. +3. With neither, the port carries no network. + +A port moves between these states in one change. Handing a server to a customer +is the change from 1 to 2. A reinstall on a NIC that also carries customer +networks is the change from 2 to 1 and back. + +A network claim that is bound while a boot claim holds its port keeps its +addresses. It reports `Programmed=False` with reason `BootAttachmentActive`, +because the port does not carry its network yet. Nothing is released. + +On a port that carries more than one network, all but one arrive tagged, and +the server's operating system must know each tag. The realizer reports the VLAN +each network arrives on, on the interface, before it reports `Prepared`. A +network that arrives untagged reports no VLAN. + ### A private segment for one server ```yaml @@ -320,16 +379,20 @@ isolated ports, a VLAN per port, or a filter on the port all satisfy the contract. A realizer that cannot build one reports the claim `Prepared=False` with a reason, and never attaches the port to the shared segment in its place. +Fleet's proposal puts every server on the boot network in isolation. In this +design the provider asks for that on each boot claim, so a site that wants a +shared boot segment can have one. + ### Where a physical claim lives A physical claim lives where compute's claims live today: in the cell that serves the server's location, in the namespace of the project whose network it names. -| Network | Namespace | +| Claim | Namespace | |---|---| -| A customer's network | The customer project's namespace in the cell | -| The boot network | The provider project's namespace in the cell | +| A network claim for a customer's network | The customer project's namespace in the cell | +| A boot claim | The provider project's namespace in the cell | Customers cannot write in a cell at all, which is the first half of keeping claim placement with the provider. The admission rule below is the second half, @@ -351,7 +414,7 @@ access in each cell. That is listed under An admission rule in each cell covers every create and update of a claim, including patches. It refuses the request when the claim, before or after the -change, has `attachmentMode: Physical`, an `attachmentPoint`, or an +change, has `attachmentMode: Physical`, an `attachmentPoint`, a `purpose`, or an `isolation`, unless the requester is one of a configured list of provider identities. The list is cell configuration, and Fleet's identity is the expected entry. @@ -363,27 +426,26 @@ The rule checks the authenticated requester, which is the only identity it can trust. It does not record that identity on the claim. NSO's own identity is exempt, because NSO writes finalizers and status on every -claim. +claim. The realizer's identity may write status on a physical claim. A second rule protects the detach step. Only three kinds of identity may remove the detach finalizer described [below](#releasing-a-physical-claim-and-proving-it): - the realizer's configured identity; -- NSO's own identity, for a claim that never had an interface; and +- NSO's own identity, for a claim the hold never recorded; and - a configured break-glass group of operators. An operator in the break-glass group uses it only after confirming on the -switch that the port no longer carries the network. NSO's runbook will say how. - -### One project holds a switch port at a time +switch that the port no longer carries the claim's network. NSO's runbook will +say how. This is NSO's proposed answer to Fleet's open question about a port NSO +cannot release. Who may be in the group is a decision for a person. -A switch port can carry several networks, for example a customer's two networks -as two VLANs on one NIC. Those networks must all belong to one project. A port -shared between two projects would let one project's traffic reach the other's. +### The switch port hold -NSO records which project holds each port in a `SwitchPortHold`: a -cluster-scoped object in the cell. NSO is its only writer. +NSO records the claims that name each port in a `SwitchPortHold`: a +cluster-scoped object in the cell. NSO is its only writer, and the realizer +reads it. ```yaml apiVersion: networking.datumapis.com/v1alpha @@ -397,55 +459,60 @@ spec: # a claim's is a hash collision, and NSO refuses the claim. switch: rack-a1-tor-1 port: Ethernet1/12 - # The project holding the port. + # The one boot claim on the port, if there is one. + boot: + namespace: ns-provider-example + name: alloc-3b9d61c2-install-1-boot + network: boot + # The project whose network claims hold the port, and those claims. consumerRef: apiGroup: resourcemanager.miloapis.com kind: Project name: customer-example - # Every claim of that project bound to the port, by namespace and name. - holders: + networkClaims: - namespace: ns-customer-example name: fleet-5d2c0e7a91b4f3c86e0d1a2b3c4d5e6f7a8b9c0d - # Set once another project's claim is waiting for the port. - draining: false + network: app ``` -NSO reads the project for `consumerRef` from the claim's namespace, the same -way it finds the project when it allocates addresses today. - -Every change to a hold is a compare-and-swap. NSO reads the hold, changes it, -and writes it back. If another writer changed the hold in between, the write -fails and NSO reads it again. That makes each of these exact under concurrency: - -- **Taking a free port.** NSO creates the hold with the claim as its only - holder. Only one create of a given name can succeed, so two projects racing - for a port cannot both win. -- **Joining a held port.** A claim of the holding project adds itself to - `holders`, unless the hold is draining. -- **Leaving a port.** A releasing claim removes itself from `holders`. When the - list becomes empty, NSO deletes the hold, on the condition that nobody has - changed it since NSO read it. A claim that joined in between makes the delete - fail, and the hold stays. -- **Waiting for a port.** A claim of another project sets `draining` and reports - `Bound=False` with reason `AttachmentPointHeld`. It allocates no address while - it waits, and its message names nothing about the other project. - -A draining hold admits no new holders, so the holding project cannot keep a -waiting project out by adding claims. Once the last holder leaves, the hold is -deleted and the next waiting claim creates its own. When several projects wait -at once, the first create wins and the others keep waiting. Fleet allocates a -server to one customer at a time, so several waiting projects mean something -upstream is already wrong. - -A port carries a network at most once. A second claim for the same port and the -same network waits, with reason `AttachmentPointHeld`, until the first is -released. That is what happens when a wipe's boot claim is written while the -install's boot claim is still releasing. +NSO reads the project for `consumerRef` from the claim's namespace, the same way +it finds the project when it allocates addresses today. The reference uses Milo's +project type, which NSO's Milo test environment already reads. + +Every change to a hold is a compare-and-swap. NSO reads the hold from the API +server rather than from a cache, changes it, and writes it back. If another +writer changed the hold in between, the write fails and NSO reads it again. +That makes each of these exact under concurrency: + +- **Taking a free port.** NSO creates the hold with the claim recorded. Only one + create of a given name can succeed. +- **Recording a boot claim.** A boot claim is recorded when `boot` is empty. A + second boot claim waits with `Bound=False` and reason `AttachmentPointHeld` + until the first is released. A wipe's boot claim written while an install's is + still releasing waits this way. +- **Recording a network claim.** A network claim is recorded when + `networkClaims` is empty, or when it already belongs to the claim's project and + does not already carry the claim's network. Otherwise the claim waits with + `AttachmentPointHeld`. It allocates no address while it waits, and its message + names nothing about any other project. +- **Leaving a port.** A releasing claim's entry is removed. When the hold has no + boot claim and no network claims left, NSO deletes it, on the condition that + nobody has changed it since NSO read it. A claim recorded in between makes the + delete fail, and the hold stays. + +A port carries a network at most once, and only one project's network claims at +a time. Two projects' network claims can never be recorded on one hold at once. + +NSO does not order waiting claims. Once the holding project's last network claim +leaves, the next claim to be recorded wins, whichever project it belongs to. The +provider decides who should hold a server, and Fleet allocates a server to one +customer at a time, so a race between projects means a provider error rather +than normal traffic. A holder that never becomes ready keeps the hold. A waiting claim's reason does not say who holds the port, because the waiting claim may belong to another -customer. The provider can read the hold itself, in the cell, to see which -claims hold it. +customer. The provider can read the hold, in the cell, to see which claims hold +it. ### Binding a physical claim, in order @@ -455,48 +522,54 @@ previous one is written: 1. NSO adds its own finalizer and the detach finalizer in one update. A claim deleted before this update completes has neither, takes nothing, and is deleted at once. -2. NSO takes or joins the port's hold. +2. NSO records the claim on the port's hold. From here on the realizer is + responsible for taking the claim's network off the port. 3. NSO allocates the addresses through IPAM. -4. NSO creates or binds the interface, copying the attachment point and +4. NSO creates or binds the interface, copying the attachment point, purpose and isolation. 5. NSO reports the claim `Bound` and `Allocated`. Kubernetes refuses a new finalizer on an object that is being deleted, so step 1 -can never add the detach finalizer to a claim that is already releasing. The -realizer never acts on a claim that lacks the detach finalizer, which closes -the other half of that race. +can never add the detach finalizer to a claim that is already releasing. NSO +reconciles one claim at a time, and it never records a claim, or creates an +interface for it, once it sees a deletion timestamp on the claim. + +The realizer acts only on claims recorded on a hold that carry the detach +finalizer and have no deletion timestamp. Recording comes before any interface +exists, so whether the claim was ever recorded on its hold answers whether the +realizer may have touched the port. Whether an interface exists does not. ### Releasing a physical claim, and proving it A provider that deletes a claim needs to know when the addresses are free and -the port is detached. The claim's absence is that signal. NSO keeps the claim -until both are true. +the port no longer carries the claim's network. The claim's absence is that +signal. NSO keeps the claim until both are true. When a physical claim is deleted: 1. NSO marks the claim releasing, so `Prepared` and `Ready` go false. -2. The detach finalizer comes off. Who removes it depends on whether the claim - ever had an interface: - - If an interface bound to the claim exists, the realizer removes the port - from the claim's network, confirms the port no longer carries it, and - removes the finalizer. - - If no interface bound to the claim exists, the port was never programmed - for it, and NSO removes the finalizer itself. A claim waiting with +2. The detach finalizer comes off. Who removes it depends on whether the hold + ever recorded the claim, read from the API server: + - If the hold records the claim, the realizer takes the claim's network off + the port, or confirms the port never carried it, and removes the finalizer. + - If the hold does not record the claim, the realizer never acted for it, and + NSO removes the finalizer itself. A claim that waited with `AttachmentPointHeld` is in this case. 3. NSO releases the addresses. Under `Delete` it deletes the interface and the IPAM claims behind it. Under `Retain` it unbinds the interface, which keeps - its addresses and stays detached until a claim of the same name binds it + its addresses and stays off the port until a claim of the same name binds it again. 4. Under `Delete`, NSO reads each IPAM claim again, and lists the IPAM allocations in the same IPAM namespace. The release is verified once each IPAM claim is gone and no allocation's `spec.claimRef` names one. Under `Retain`, IPAM keeps the allocations on purpose, so the release is verified once the interface is unbound. -5. NSO leaves the port's hold. +5. NSO removes the claim's entry from the hold. 6. NSO removes its own finalizer, and the claim is gone. Until each step completes, the claim stays and its conditions say which step it -is waiting on. +is waiting on. A hold entry whose claim no longer exists is removed the next +time NSO writes that hold, so an entry cannot outlive its claim. NSO never releases an address while the detach finalizer is present. A claim whose realizer never answers therefore stays, with its addresses held, and that @@ -515,49 +588,66 @@ claims would make every claim's deletion wait on IPAM, including during namespace and project teardown. That choice is listed under [Decisions for a person](#decisions-for-a-person). -### Handing a server from the boot network to a customer - -Handing a server over is one change from the provider's side. In one pass, -Fleet deletes the server's boot claim and writes the customer's claims. NSO -puts the rest in order: - -1. The customer's claims find the port held by the provider project. They mark - the hold draining and wait with `AttachmentPointHeld`. -2. The boot claim releases. The realizer removes the port from the boot - network, and NSO releases and verifies the boot address. -3. The boot claim leaves the hold. It was the last holder, so NSO deletes the - hold. -4. The customer's claims take the port, allocate their addresses and bind. -5. The realizer adds the port to the customer's networks and reports each claim - `Programmed`. - -The port is never in both projects' networks at once, and the realizer is the -only thing that changes its membership. - -The reverse trip, from a customer back to the boot network for a wipe, follows -the same steps with the projects swapped. Its precondition is that every one of -the customer's claims on the port is deleted. Fleet's proposal also considers a -boot NIC that carries customer networks as tagged VLANs. On such a port, a boot -claim waits behind the customer's hold until the customer's claims are all -gone, which matches Fleet's order of release before wipe. +### Installing a server and handing it to a customer + +Handing a server over is one change on the port. Fleet writes the claims, and +NSO and the realizer do the rest: + +1. Fleet writes the install's boot claim and the customer's network claims. The + boot claim is recorded on the hold, and so are the network claims. +2. The realizer puts the port on the boot network, untagged, and reports the + boot claim `Programmed`. The network claims are bound and allocated, and + report `Programmed=False` with reason `BootAttachmentActive`. +3. Fleet installs the server, with the customer's addresses from the network + claims in the host configuration and the boot address from the boot claim. +4. Fleet deletes the boot claim when its rules allow. +5. The realizer changes the port in one step, off the boot network and onto the + customer's networks. It then removes the boot claim's detach finalizer and + reports the network claims `Programmed`. +6. NSO releases and verifies the boot address, and the boot claim is gone. + +At no point does the port carry the boot network and a customer's network +together. + +The release at the end of an allocation runs the other way. Fleet deletes the +customer's network claims, and the realizer takes their networks off the port. +Fleet then writes the wipe's boot claim, and the port joins the boot network. +That matches Fleet's order of release before wipe, although the hold would keep +the port safe in either order. + +Which ports change depends on the boot NIC: + +- **Shared boot NIC.** One port carries the boot network during an install or a + wipe, and the customer's networks otherwise. A reinstall moves that port off + the customer's networks while its boot claim exists, and back afterwards. +- **Dedicated boot NIC.** The boot port only ever carries the boot network, and + only while a boot claim names it. The customer's ports keep their networks + through a reinstall, and handoff is their first attachment, not a move. ### The boot network The boot network is an ordinary NSO `Network` in the provider project. It -reaches each location that has servers the way any network does, and its -subnet in a location provides the gateway servers boot through. +reaches each location that has servers the way any network does. Its subnet in +a location provides the gateway servers boot through, and network operations +gives the realizer that site's provisioning VLAN as the boot network's segment +there. -- **Addresses.** A boot claim's addresses come from IPAM through NSO, like any +- **Addresses.** A boot claim's address comes from IPAM through NSO, like any claim's. The provider chooses the boot network's address families. Firmware usually needs IPv4. - **Lifetime.** The provider names a boot claim from the operation it serves, creates it before the operation starts and deletes it when the operation ends. NSO adds no lifetime of its own. - **Isolation.** The provider sets `isolation: Private` on a boot claim to keep - the server away from the others on the boot network. Leaving it unset shares - the segment. + the server away from the others on the boot network. - **Serving firmware.** NSO hands out the address and the gateway. Whatever - answers firmware's DHCP request with that address is the provider's. + answers firmware's DHCP request with that address is the provider's, and its + configuration must use the boot network's subnet at that site. + +A boot claim carries its address from the first delivery. NSO does not offer a +physical claim without an address, because every claim NSO binds allocates at +least one family. [How this lines up with Fleet's proposal](#how-this-lines-up-with-fleets-proposal) +explains why that differs from Fleet's plan. ### The physical realizer @@ -568,28 +658,28 @@ contract against a simulated switch. The realizer: -- reads `Physical` interfaces in its cell and the claims bound to them; -- counts a claim toward a port's membership only while the claim has no - deletion timestamp and carries the detach finalizer; -- works out each port's desired membership from those claims, their networks - and their `isolation`; -- changes a port's membership in one place, one port at a time, so it is the - only writer of that membership; -- writes `Prepared` and `Programmed` on the interface and on the claim, as the - existing realizer for virtual interfaces does, and `status.attachmentRef` if - it has an object to name; +- reads the holds in its cell, the claims they record, and the interfaces bound + to them; +- counts a claim only while it is recorded on a hold, carries the detach + finalizer, and has no deletion timestamp; +- works out what each port carries by the rules in + [What a port carries](#what-a-port-carries); +- changes each port in one step, one port at a time, so it is the only writer of + what the port carries, including its untagged VLAN and its isolation; +- writes `Prepared`, `Programmed`, and the VLAN each network arrives on, on the + interface and on the claim, and `status.attachmentRef` if it has an object to + name; - removes the detach finalizer from a deleted claim once the port no longer carries that claim's network. Two rules keep it safe: -- **Check after changing a port.** The realizer reads the claim again after it - changes a port. If the claim has gained a deletion timestamp meanwhile, the - realizer removes the membership it just added before it removes the detach - finalizer. +- **Check after changing a port.** The realizer reads the claims again from the + API server after it changes a port. If one has gained a deletion timestamp + meanwhile, the realizer changes the port again before it removes that claim's + detach finalizer. - **Fail closed.** A realizer that cannot reach a switch leaves `Programmed` - false and keeps the detach finalizer. It never removes the finalizer on a - guess. + as it was and keeps every detach finalizer. It never removes one on a guess. How the realizer reaches a switch, and how a network maps to a segment at a site, belong to the Networking team. The test realizer stands in for both in @@ -597,16 +687,19 @@ NSO's own tests, and any other team may run it in theirs. ### Conditions a physical claim reports -A physical claim reports the same five conditions as any claim, with the same -owners: +A physical claim reports the same five conditions as any claim. Each has one +writer: | Condition | Written by | Physical meaning | |---|---|---| -| `Bound` | NSO | The project holds the port and an interface is bound. | +| `Bound` | NSO | The hold records the claim and an interface is bound. | | `Allocated` | NSO | Every requested family holds an address. | | `Prepared` | Realizer, on the interface and the claim | The realizer accepted the attachment point and can build its segment. | -| `Programmed` | Realizer, on the interface and the claim | The port carries the network. | -| `Ready` | NSO, and the realizer when it writes `Programmed` | All four are true. | +| `Programmed` | Realizer, on the interface and the claim | The port carries the claim's network. | +| `Ready` | NSO | All four are true. NSO derives it each time the claim changes. | + +The existing realizer for virtual interfaces also writes `Ready` on a claim. The +physical realizer does not, so `Ready` keeps one writer. The [interface design](network-interfaces.md#how-the-guest-consumes-it-and-when-it-is-safe-to-start) says nothing may gate creating a workload on `Programmed`. That rule exists @@ -614,21 +707,58 @@ because a virtual interface is attached while its workload's sandbox is being created, so a consumer that waits for `Programmed` first waits forever. A physical port is attached with no workload at all. The realizer programs it -as soon as the claim binds, whether the server is on or off. So a provider may -wait for `Programmed` before installing a server or handing it over, as -Fleet's `NetworkReady` already does. The rule for the other modes stands. +once the claim is recorded and nothing outranks it, whether the server is on or +off. So a provider may wait for a boot claim's `Programmed` before it boots a +server, and for its network claims' `Programmed` before it reports the server +ready, as Fleet's proposal does. The rule for the other modes stands. + +## How this lines up with Fleet's proposal + +This compares against fleet#186 at `d850b06a`. Fleet's side is a proposal, not +an agreed contract. + +| Fleet expects | This design | Agreement | +|---|---|---| +| `Physical` mode, attachment point on the claim and interface | Same | Agrees | +| A provider-owned boot network, isolated between servers | An ordinary NSO network. Isolation is per boot claim, and Fleet asks for it on each one. | Agrees, with isolation optional | +| A separate boot claim per network-booting operation, made before the operation | A physical claim with `purpose: Boot`, named by Fleet from the operation | Agrees | +| A port carries the boot network while a boot claim names it, otherwise its customer networks, otherwise nothing | [What a port carries](#what-a-port-carries) | Agrees | +| Handoff is one step after the boot claim's release | The realizer moves the port in one change once the boot claim is deleted | Agrees | +| NSO owns the untagged VLAN and boot isolation. Network operations keeps the base profile and DHCP snooping. | Same | Agrees | +| Boot claim released under the same verified rules as an address | Verified release applies to every physical claim | Agrees | +| Only Fleet's identity creates physical claims, where the customer cannot write | Provider-only admission, claims in the cell | Agrees. Where Fleet writes claims is a decision for a person. | +| At first, a boot claim with no address, and a separate IPAM claim made after `Programmed` | Every boot claim carries its address from the first delivery | **Differs** | +| The realizer checks each attachment point against Fleet's allocation | The provider identity is trusted, and nothing reads Fleet | **Differs** | +| Host configuration carries MAC, addresses, gateway and MTU | The realizer also reports the VLAN each network arrives on | **Differs.** Fleet's host configuration would need the VLAN. | + +Where the design differs, NSO's model points somewhere better: + +- **The boot address.** NSO allocates through IPAM for every claim, so a boot + claim without an address would be a special case in NSO that Fleet would drop + again. Both pieces of NSO land together, so there is no time when NSO attaches + a port and cannot address it. Fleet could skip the separate IPAM claim and the + later swap, and wait for the boot claim's `Allocated` and `Programmed`. +- **Checking the attachment point.** For the realizer to read Fleet's + allocations, NSO would need a contract with Fleet's API, a second authority + over the same port, and a way to fail when Fleet is unreachable. Provider-only + admission puts the same trust in one place. +- **The VLAN a network arrives on.** A port carrying two customer networks + delivers at least one of them tagged. Without the tag, the installer cannot + configure that interface. ## Failure and recovery | Failure | What happens | |---|---| | NSO restarts while binding | Each step is written before the next starts, and the hold and IPAM claims are named from the port and the claim, so the next attempt finds them. | -| Two projects claim one port at once | One hold create wins. The other claim waits with `AttachmentPointHeld`. | -| A project binds a claim while its last claim on the port leaves | Both write the hold by compare-and-swap. Either the join lands first and the hold stays, or the delete lands first and the joining claim creates a new hold. | +| Two projects claim one port at once | Both write the hold by compare-and-swap. The first recorded wins, and the other claim waits with `AttachmentPointHeld`. | +| A project records a claim while its last claim on the port leaves | Either the record lands first and the hold stays, or the delete lands first and the new claim creates a new hold. | | A claim is deleted before NSO adds its finalizers | The claim is deleted at once. Nothing was taken for it. | -| A claim waiting for a port is deleted | No interface was bound to it, so NSO removes the detach finalizer itself and the claim is deleted. | -| The realizer restarts while attaching | It recomputes each port's membership from the claims, and removes any membership whose claim has a deletion timestamp. | -| The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or an operator in the break-glass group removes it. | +| A claim waiting for a port is deleted | The hold never recorded it, so NSO removes the detach finalizer itself and the claim is deleted. | +| NSO crashes after recording a claim and before creating its interface | The hold records the claim, so on deletion the realizer, not NSO, removes the detach finalizer, after confirming the port does not carry the network. | +| The realizer restarts while changing a port | It recomputes what each port carries from the holds and claims, and changes the port again if a claim has a deletion timestamp. | +| The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or a break-glass operator removes it. | +| NSO is down | No new claim binds and no claim releases. Ports keep what they carry. Fleet's proposal holds installs, wipes and releases until NSO returns. | | IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | | IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | | A claim is recreated under a name whose claim is still releasing | The create is refused as already existing. The writer retries after the old claim is gone. | @@ -638,24 +768,25 @@ Fleet's `NetworkReady` already does. The rule for the other modes stands. Each step is one draft PR, stacked on the one before it, and each ships with tests for concurrency, authorization, lifecycle and recovery. -1. **API.** The `Physical` mode, `attachmentPoint` and `isolation` on the claim - and the interface, with their validation and immutability, and a test that - the project copy omits both. +1. **API.** The `Physical` mode, `attachmentPoint`, `purpose` and `isolation` on + the claim and the interface, with their validation and immutability, and a + test that the project copy omits them. 2. **Admission.** The rule that limits physical claims to provider identities, and the rule that limits removing the detach finalizer. 3. **Verified release.** NSO keeps a physical claim until IPAM confirms its addresses are released. -4. **Port holds and detach.** The `SwitchPortHold`, the binding order, the wait - for another project's hold, and the detach finalizer. -5. **Test realizer.** The realizer contract against a simulated switch, so - NSO's tests, and any team's, can run a physical attachment end to end. +4. **Port holds and detach.** The `SwitchPortHold`, the binding order, waiting + for a port, and the detach finalizer. +5. **Test realizer.** The realizer contract against a simulated switch, + including boot precedence and the one-step move, so NSO's tests, and any + team's, can run a physical attachment end to end. ## Decisions for a person - **The realizer that programs real switches.** NSO ships the contract and a test realizer. Someone on the Networking team must agree to build the real - one against this contract, including how it reaches switches and how a - network maps to a segment at a site. + one against this contract, including how it reaches switches, how a network + maps to a segment at a site, and how it reports the VLAN a network arrives on. - **Where Fleet writes claims.** This design places physical claims in the location's cell, like compute's. Fleet's adapter writes them next to the customer's Networks with one client today. Fleet would need a second client @@ -663,33 +794,44 @@ tests for concurrency, authorization, lifecycle and recovery. it. - **Which identities are providers, realizers and break-glass operators.** Each cell's admission rules need them named, per environment. -- **Boot addresses through NSO, not IPAM directly.** Fleet's proposal claims - boot addresses from IPAM itself. This design routes them through NSO's boot - network. Fleet must agree to move. +- **A port NSO cannot release.** This design proposes a break-glass group that + may remove a detach finalizer after confirming the port on the switch. Who is + in it, and who confirms the port, needs an owner. +- **Boot addresses from the first delivery.** Fleet plans an address-less boot + claim and a separate IPAM claim at first. This design gives every boot claim + its address from the start. Fleet must agree to skip the interim step, or ask + NSO for an address-less physical claim. - **Checking the attachment point against Fleet's records.** Fleet's proposal asks the realizer to check each attachment point against the allocation Fleet records. This design trusts the provider identity instead. If that check is still wanted, the realizer needs a contract with Fleet that this document does not define. +- **The VLAN in Fleet's host configuration.** A port that carries two networks + delivers at least one tagged. Fleet must agree to carry the VLAN the realizer + reports into host configuration. - **Retain on a physical claim.** A retained physical interface keeps its - addresses and is detached. Whether providers need that, or physical claims - should accept only `Delete`, needs a product answer. + addresses and stays off the port. Whether providers need that, or physical + claims should accept only `Delete`, needs a product answer. - **Verified release for every mode.** This design verifies release for physical claims only. Whether compute's claims should also wait for IPAM to confirm, and with what limit on that wait, needs the compute team's view. ## Drawbacks +- **Every network boot needs NSO.** Only NSO attaches a port to the boot network, + so installs, wipes and recoveries by network boot all wait while NSO is down. - **A release can be slow, and can stall.** Deleting a physical claim waits on a switch and on IPAM. A switch outage holds addresses and servers until it clears or an operator steps in. - **One more object per port.** Each attached port costs a `SwitchPortHold` in - the cell for as long as it is attached. + the cell for as long as any claim names it. - **The attachment point is trusted.** A provider identity that writes a wrong port attaches the wrong server. The admission rule narrows who can make that mistake, but it cannot catch the mistake. - **A stuck holder blocks the port.** A claim that holds a port and never becomes ready keeps other projects out until the provider deletes it. +- **Waiting claims are not ordered.** When a port frees up, whichever claim is + recorded first takes it. ## Alternatives @@ -698,21 +840,27 @@ tests for concurrency, authorization, lifecycle and recovery. - **A separate `PhysicalAttachment` kind instead of a mode.** Rejected. It would repeat the claim's addressing, binding and release, and give providers two ways to ask for an interface. +- **A boot network marked on the `Network`.** Rejected. Any project can write its + own networks, so a marker there would let a customer's network outrank others + on a port. `purpose: Boot` sits on a claim only providers can write. +- **Network claims wait until the boot claim is gone.** Rejected. An install + needs the customer's addresses before it runs, so customer claims that could + not bind while the install's boot claim exists would never get them. - **A handoff object that moves a port from one network to another.** - Rejected. The hold and the detach finalizer already order the move, and a + Rejected. The hold and the realizer's rules already order the move, and a handoff object would be a second writer for the same port. - **Exclusivity by listing interfaces instead of a hold.** Rejected. Two claims reconciled at once can each list, find the port free, and both bind. Writing one named hold by compare-and-swap cannot race. +- **Deciding the detach step from whether an interface exists.** Rejected. NSO + creates the interface after it records the claim, so a crash in between would + let NSO remove the finalizer for a port the realizer may have changed. - **The detach finalizer on the interface instead of the claim.** Rejected. Under `Retain` the interface is never deleted, so a finalizer on it would never be used to signal a detach. -- **Isolation as a property of the network.** Rejected. Fleet wants a private - segment per server on a shared boot network, so the choice belongs to each - attachment. -- **The boot network outside NSO**, as Fleet's proposal describes. Rejected - here because it gives a switch port two writers and two release paths. It - remains Fleet's choice, listed above. +- **Isolation as a property of the network.** Rejected. Isolation is a choice + for each attachment, so a site can isolate some servers on a network and not + others. ## Open questions From 9d9f67f41fca3436708fcd92cb0299e64bcbc751 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:07:32 -0600 Subject: [PATCH 04/11] docs: Make physical port changes fail safe Re-review found that the one-step port change had no defined behavior when it failed partway, that boot isolation became a field Fleet must set, and that a boot claim could sit in any namespace. Key changes: - withdraw Programmed before a port change and read the port back - make an unset isolation private on boot claims, shared otherwise - accept boot claims only in configured provider projects - list Fleet setting purpose: Boot as a difference and a decision - define consumerRef lifecycle, entry matching, and uncached GC reads Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 96 ++++++++++++++++++------ 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index 265b2efc..53db8106 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -237,14 +237,14 @@ spec: macAddress: "00:00:5e:00:53:01" switch: rack-a1-tor-1 port: Ethernet1/12 - isolation: Private ipFamilies: - IPv4 reclaimPolicy: Delete ``` -Its status carries the boot address, and `Programmed` turns true once the port -carries the boot network untagged. +It leaves `isolation` unset, so the port joins a private segment of the boot +network. Its status carries the boot address, and `Programmed` turns true once +the port carries the boot network untagged. ### User stories @@ -330,7 +330,12 @@ A physical claim is one of two kinds: `purpose` is immutable and only valid on a physical claim. Only provider identities may set it, like everything else on a physical claim. -NSO does not decide which networks are boot networks. A boot claim may name any +A boot claim is accepted only in a provider project's namespace. Each cell's +configuration lists the provider projects, and admission refuses `purpose: +Boot` in a namespace whose project is not on the list. A customer's network can +therefore never outrank another claim on a port, whoever writes the claim. + +NSO does not mark which networks are boot networks. A boot claim may name any network in its own namespace, and the provider's boot network is the one it names in practice. That keeps the boot network an ordinary NSO network. @@ -365,9 +370,16 @@ spec: isolation: Private ``` -`isolation` is optional, immutable, and only valid on a physical claim. Left -unset, the port joins the network's shared segment and the server can reach -every other member of the network. +`isolation` is optional, immutable, and only valid on a physical claim. It +takes `Private` or `Shared`. Left unset, it follows the claim's purpose: + +- A boot claim is private, so servers on the boot network never reach each + other unless the provider writes `isolation: Shared`. +- A network claim is shared, so the server reaches every other member of the + network unless the provider writes `isolation: Private`. + +The realizer applies that rule. NSO stores no default on the claim, so a writer +comparing its claim with what it reads back sees no field it did not set. `Private` asks the realizer to put the port in a segment of its own on the network. The server reaches the network's gateway and nothing else on the @@ -379,9 +391,9 @@ isolated ports, a VLAN per port, or a filter on the port all satisfy the contract. A realizer that cannot build one reports the claim `Prepared=False` with a reason, and never attaches the port to the shared segment in its place. -Fleet's proposal puts every server on the boot network in isolation. In this -design the provider asks for that on each boot claim, so a site that wants a -shared boot segment can have one. +Fleet's proposal puts every server on the boot network in isolation, and a +boot claim that leaves `isolation` unset gets exactly that. A site that wants a +shared boot segment writes `isolation: Shared`. ### Where a physical claim lives @@ -433,9 +445,13 @@ the detach finalizer described [below](#releasing-a-physical-claim-and-proving-it): - the realizer's configured identity; -- NSO's own identity, for a claim the hold never recorded; and +- NSO's own identity; and - a configured break-glass group of operators. +Admission cannot read the hold, so it only checks who is asking. NSO's own code +carries the narrower rule that it removes the finalizer only from a claim the +hold never recorded. + An operator in the break-glass group uses it only after confirming on the switch that the port no longer carries the claim's network. NSO's runbook will say how. This is NSO's proposed answer to Fleet's open question about a port NSO @@ -476,8 +492,10 @@ spec: ``` NSO reads the project for `consumerRef` from the claim's namespace, the same way -it finds the project when it allocates addresses today. The reference uses Milo's -project type, which NSO's Milo test environment already reads. +it finds the project when it allocates addresses today. NSO sets `consumerRef` +when it records the first network claim, and clears it when it removes the last +one. A hold kept alive only by a boot claim names no project. The reference uses +Milo's project type, which NSO's Milo test environment already reads. Every change to a hold is a compare-and-swap. NSO reads the hold from the API server rather than from a cache, changes it, and writes it back. If another @@ -495,6 +513,9 @@ That makes each of these exact under concurrency: does not already carry the claim's network. Otherwise the claim waits with `AttachmentPointHeld`. It allocates no address while it waits, and its message names nothing about any other project. +- **Recording again.** An entry is matched by the claim's namespace, name and + network. An entry with the claim's name and another network is left from an + earlier claim of that name, and NSO replaces it. - **Leaving a port.** A releasing claim's entry is removed. When the hold has no boot claim and no network claims left, NSO deletes it, on the condition that nobody has changed it since NSO read it. A claim recorded in between makes the @@ -568,8 +589,9 @@ When a physical claim is deleted: 6. NSO removes its own finalizer, and the claim is gone. Until each step completes, the claim stays and its conditions say which step it -is waiting on. A hold entry whose claim no longer exists is removed the next -time NSO writes that hold, so an entry cannot outlive its claim. +is waiting on. A hold entry whose claim no longer exists, read from the API +server rather than a cache, is removed the next time NSO writes that hold, so +an entry cannot outlive its claim. NSO never releases an address while the detach finalizer is present. A claim whose realizer never answers therefore stays, with its addresses held, and that @@ -672,14 +694,28 @@ The realizer: - removes the detach finalizer from a deleted claim once the port no longer carries that claim's network. -Two rules keep it safe: - +Three rules keep it safe: + +- **Withdraw before changing a port.** Before it changes a port, the realizer + writes `Programmed=False` on every claim whose network the change adds or + removes. A claim never reports `Programmed=True` for a port that is between + states. +- **Read the port back.** A change counts only once the realizer has read the + port back from the switch and found what it asked for. A change that fails, + or only partly applies, leaves the port's state unknown. The realizer keeps + every detach finalizer on that port, leaves `Programmed` false, and tries + again until the read-back matches. - **Check after changing a port.** The realizer reads the claims again from the API server after it changes a port. If one has gained a deletion timestamp meanwhile, the realizer changes the port again before it removes that claim's detach finalizer. -- **Fail closed.** A realizer that cannot reach a switch leaves `Programmed` - as it was and keeps every detach finalizer. It never removes one on a guess. +- **Fail closed.** A realizer that cannot reach a switch changes nothing on the + claims beyond the withdrawal above, and keeps every detach finalizer. It never + removes one on a guess. + +A boot claim recorded on a port whose network claims report `Programmed=True` +starts with that withdrawal. The network claims go false, the port moves to the +boot network, and only then does the boot claim go true. How the realizer reaches a switch, and how a network maps to a segment at a site, belong to the Networking team. The test realizer stands in for both in @@ -698,8 +734,9 @@ writer: | `Programmed` | Realizer, on the interface and the claim | The port carries the claim's network. | | `Ready` | NSO | All four are true. NSO derives it each time the claim changes. | -The existing realizer for virtual interfaces also writes `Ready` on a claim. The -physical realizer does not, so `Ready` keeps one writer. +The existing realizer for virtual interfaces writes `Ready` on a claim only to +set it `Unknown` while it migrates an attachment. The physical realizer never +writes `Ready`, so `Ready` keeps one writer. The [interface design](network-interfaces.md#how-the-guest-consumes-it-and-when-it-is-safe-to-start) says nothing may gate creating a workload on `Programmed`. That rule exists @@ -720,8 +757,9 @@ an agreed contract. | Fleet expects | This design | Agreement | |---|---|---| | `Physical` mode, attachment point on the claim and interface | Same | Agrees | -| A provider-owned boot network, isolated between servers | An ordinary NSO network. Isolation is per boot claim, and Fleet asks for it on each one. | Agrees, with isolation optional | -| A separate boot claim per network-booting operation, made before the operation | A physical claim with `purpose: Boot`, named by Fleet from the operation | Agrees | +| A provider-owned boot network, isolated between servers | An ordinary NSO network. A boot claim is private unless it says `isolation: Shared`. | Agrees | +| A separate boot claim per network-booting operation, made before the operation | A physical claim with `purpose: Boot`, named by Fleet from the operation, in a provider project's namespace | Agrees | +| NSO knows a boot claim from the boot network it names | NSO knows a boot claim from `purpose: Boot`, which Fleet must set | **Differs** | | A port carries the boot network while a boot claim names it, otherwise its customer networks, otherwise nothing | [What a port carries](#what-a-port-carries) | Agrees | | Handoff is one step after the boot claim's release | The realizer moves the port in one change once the boot claim is deleted | Agrees | | NSO owns the untagged VLAN and boot isolation. Network operations keeps the base profile and DHCP snooping. | Same | Agrees | @@ -733,6 +771,10 @@ an agreed contract. Where the design differs, NSO's model points somewhere better: +- **Knowing a boot claim.** If NSO took precedence from the network a claim + names, it would need a way to mark a network as a boot network, and any + project can write its own networks. `purpose: Boot` sits on a claim that only + providers can write, in a namespace only providers may use for it. - **The boot address.** NSO allocates through IPAM for every claim, so a boot claim without an address would be a special case in NSO that Fleet would drop again. Both pieces of NSO land together, so there is no time when NSO attaches @@ -756,6 +798,7 @@ Where the design differs, NSO's model points somewhere better: | A claim is deleted before NSO adds its finalizers | The claim is deleted at once. Nothing was taken for it. | | A claim waiting for a port is deleted | The hold never recorded it, so NSO removes the detach finalizer itself and the claim is deleted. | | NSO crashes after recording a claim and before creating its interface | The hold records the claim, so on deletion the realizer, not NSO, removes the detach finalizer, after confirming the port does not carry the network. | +| A port change fails or only partly applies | Every claim the change touched already reports `Programmed=False`. The realizer keeps the port's detach finalizers and retries until it reads the intended state back from the switch. | | The realizer restarts while changing a port | It recomputes what each port carries from the holds and claims, and changes the port again if a claim has a deletion timestamp. | | The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or a break-glass operator removes it. | | NSO is down | No new claim binds and no claim releases. Ports keep what they carry. Fleet's proposal holds installs, wipes and releases until NSO returns. | @@ -792,8 +835,11 @@ tests for concurrency, authorization, lifecycle and recovery. customer's Networks with one client today. Fleet would need a second client and write access in each cell, and the platform owners must agree to grant it. -- **Which identities are providers, realizers and break-glass operators.** Each - cell's admission rules need them named, per environment. +- **Which identities are providers, realizers and break-glass operators, and + which projects are provider projects.** Each cell's admission rules need them + named, per environment. +- **Fleet sets `purpose: Boot`.** NSO knows a boot claim from that field, not + from the network it names. Fleet must agree to set it on each boot claim. - **A port NSO cannot release.** This design proposes a break-glass group that may remove a detach finalizer after confirming the port on the switch. Who is in it, and who confirms the port, needs an owner. From 860ed0a733997b2c13452bd64d42f780bbd90ef9 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:09:00 -0600 Subject: [PATCH 05/11] docs: Name how admission finds a claim's project Re-review found the provider-project rule for boot claims did not say where admission reads a namespace's project, and one line still told providers to set boot isolation by hand. Key changes: - read the project from the namespace's upstream-cluster-name label - add the provider-project refusal to the admission section - describe boot isolation by its unset default - name the PortChanging reason and skip a change if it cannot be written Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index 53db8106..deed9f73 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -332,7 +332,10 @@ identities may set it, like everything else on a physical claim. A boot claim is accepted only in a provider project's namespace. Each cell's configuration lists the provider projects, and admission refuses `purpose: -Boot` in a namespace whose project is not on the list. A customer's network can +Boot` in a namespace whose project is not on the list. Admission reads the +project from the namespace's `meta.datumapis.com/upstream-cluster-name` label, +the label NSO already reads to find a namespace's project before it allocates +addresses. A customer's network can therefore never outrank another claim on a port, whoever writes the claim. NSO does not mark which networks are boot networks. A boot claim may name any @@ -437,6 +440,11 @@ claim compute writes in any other mode is admitted exactly as it is today. The rule checks the authenticated requester, which is the only identity it can trust. It does not record that identity on the claim. +A provider identity is still refused a claim with `purpose: Boot` in a +namespace whose project is not on the cell's list of provider projects, as +[Boot claims and network claims](#boot-claims-and-network-claims) describes. +Both lists are parameters of the admission rule, set per cell. + NSO's own identity is exempt, because NSO writes finalizers and status on every claim. The realizer's identity may write status on a physical claim. @@ -660,8 +668,9 @@ there. - **Lifetime.** The provider names a boot claim from the operation it serves, creates it before the operation starts and deletes it when the operation ends. NSO adds no lifetime of its own. -- **Isolation.** The provider sets `isolation: Private` on a boot claim to keep - the server away from the others on the boot network. +- **Isolation.** A boot claim that leaves `isolation` unset keeps the server + away from the others on the boot network. A provider that wants a shared boot + segment writes `isolation: Shared`. - **Serving firmware.** NSO hands out the address and the gateway. Whatever answers firmware's DHCP request with that address is the provider's, and its configuration must use the boot network's subnet at that site. @@ -697,9 +706,10 @@ The realizer: Three rules keep it safe: - **Withdraw before changing a port.** Before it changes a port, the realizer - writes `Programmed=False` on every claim whose network the change adds or - removes. A claim never reports `Programmed=True` for a port that is between - states. + writes `Programmed=False`, with reason `PortChanging`, on every claim whose + network the change adds or removes. If that write fails, the realizer leaves + the port alone and tries again. A claim never reports `Programmed=True` for a + port that is between states. - **Read the port back.** A change counts only once the realizer has read the port back from the switch and found what it asked for. A change that fails, or only partly applies, leaves the port's state unknown. The realizer keeps From eb4757649cc61cf3b7bfa321621e535d3baf70b4 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:09:47 -0600 Subject: [PATCH 06/11] docs: Decode the project label in boot admission Re-review found that the provider-project rule compared projects without saying the namespace label is encoded, so a rule matching the raw label against project names would never match. Key changes: - list provider projects by name and decode the label before comparing - refuse boot claims in a namespace with no project label Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index deed9f73..fe6b648e 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -331,12 +331,19 @@ A physical claim is one of two kinds: identities may set it, like everything else on a physical claim. A boot claim is accepted only in a provider project's namespace. Each cell's -configuration lists the provider projects, and admission refuses `purpose: -Boot` in a namespace whose project is not on the list. Admission reads the -project from the namespace's `meta.datumapis.com/upstream-cluster-name` label, -the label NSO already reads to find a namespace's project before it allocates -addresses. A customer's network can -therefore never outrank another claim on a port, whoever writes the claim. +configuration lists the provider projects by project name, and admission +refuses `purpose: Boot` in a namespace whose project is not on the list. + +Admission reads the project from the namespace's +`meta.datumapis.com/upstream-cluster-name` label, the label NSO already reads +to find a namespace's project before it allocates addresses. The label holds an +encoded value, not a bare project name, so admission decodes it the way NSO +does: it turns each underscore into a slash, then drops the `cluster-` prefix +and any leading slash. It compares the decoded name with the list, never the +raw label. A namespace without the label names no project and is refused. + +A customer's network can therefore never outrank another claim on a port, +whoever writes the claim. NSO does not mark which networks are boot networks. A boot claim may name any network in its own namespace, and the provider's boot network is the one it From 075011253734bdd3c82e445b8a0be976a6e84804 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:24:56 -0600 Subject: [PATCH 07/11] docs: Boot through a central DHCP relay Fleet now runs its DHCP and boot file servers in a central cluster, and each site router relays DHCP to it. NSO's part is unchanged, but the boot network now has to line up with the router and the central server. Key changes: - require the site router to be the boot network's gateway - require each site's boot subnet to be distinct - require a route from the boot network to the central cluster only - add a failure row, an alignment row, and two decisions Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 53 +++++++++++++++++++++--- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index fe6b648e..cdea2d0b 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -678,9 +678,40 @@ there. - **Isolation.** A boot claim that leaves `isolation` unset keeps the server away from the others on the boot network. A provider that wants a shared boot segment writes `isolation: Shared`. -- **Serving firmware.** NSO hands out the address and the gateway. Whatever - answers firmware's DHCP request with that address is the provider's, and its - configuration must use the boot network's subnet at that site. +- **Serving firmware.** NSO hands out the address and the gateway. Fleet's DHCP + and boot file servers answer firmware with them, from a central cluster + rather than from the site. + +#### Reaching the central DHCP and boot file servers + +Fleet's DHCP and boot file servers run in a central cluster. Each site's router +relays firmware's DHCP requests to that cluster, and firmware then fetches its +boot file from it through the same router. NSO's part does not change: it +attaches the port to the boot network and assigns the address. Three things +around it must hold for a relayed boot to work: + +- **The site router is the boot network's gateway.** The router relays DHCP + from the gateway address of the boot network's subnet at that site, and the + central server picks the site's subnet by that relay address. The gateway NSO + reports on a boot claim must therefore be the router's address on the + provisioning VLAN. +- **Each site's boot subnet is distinct.** One central server serves every + site, so two sites whose boot subnets overlap would look the same to it. The + provider must give the boot network a subnet in each location that overlaps + no other location's. +- **The boot network routes to the central cluster.** Firmware sends every + request beyond its own subnet through the gateway. The site router must route + the boot network to the central DHCP and boot file servers and to nothing + else, as Fleet's proposal already asks network operations to do for the + site's DHCP service. + +A private segment still works. A server on a private segment reaches the +network's gateway, which is the router, and every relayed request and boot file +fetch goes through the router. + +Routing and relays are network operations' configuration, not NSO's. Who keeps +the router's gateway address and the boot subnets in step with NSO's boot +network is listed under [Decisions for a person](#decisions-for-a-person). A boot claim carries its address from the first delivery. NSO does not offer a physical claim without an address, because every claim NSO binds allocates at @@ -768,8 +799,10 @@ ready, as Fleet's proposal does. The rule for the other modes stands. ## How this lines up with Fleet's proposal -This compares against fleet#186 at `d850b06a`. Fleet's side is a proposal, not -an agreed contract. +This compares against fleet#186 at `d850b06a`, plus Fleet's later move of its +DHCP and boot file servers to a central cluster behind each site router's +relay, which its proposal does not yet describe. Fleet's side is a proposal, +not an agreed contract. | Fleet expects | This design | Agreement | |---|---|---| @@ -781,6 +814,7 @@ an agreed contract. | Handoff is one step after the boot claim's release | The realizer moves the port in one change once the boot claim is deleted | Agrees | | NSO owns the untagged VLAN and boot isolation. Network operations keeps the base profile and DHCP snooping. | Same | Agrees | | Boot claim released under the same verified rules as an address | Verified release applies to every physical claim | Agrees | +| DHCP and boot file servers in a central cluster, reached through each site router's relay | NSO attaches the port and assigns the address. The router is the boot network's gateway at each site, and each site's boot subnet is distinct. | Agrees. Keeping the router and subnets in step with NSO is a decision for a person. | | Only Fleet's identity creates physical claims, where the customer cannot write | Provider-only admission, claims in the cell | Agrees. Where Fleet writes claims is a decision for a person. | | At first, a boot claim with no address, and a separate IPAM claim made after `Programmed` | Every boot claim carries its address from the first delivery | **Differs** | | The realizer checks each attachment point against Fleet's allocation | The provider identity is trusted, and nothing reads Fleet | **Differs** | @@ -819,6 +853,7 @@ Where the design differs, NSO's model points somewhere better: | The realizer restarts while changing a port | It recomputes what each port carries from the holds and claims, and changes the port again if a claim has a deletion timestamp. | | The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or a break-glass operator removes it. | | NSO is down | No new claim binds and no claim releases. Ports keep what they carry. Fleet's proposal holds installs, wipes and releases until NSO returns. | +| The central DHCP or boot file servers are unreachable from a site | NSO is unaffected. A boot claim stays `Programmed`, since the port carries the boot network, and the install waits on Fleet's own DHCP evidence. Releasing the boot claim works as usual. | | IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | | IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | | A claim is recreated under a name whose claim is still releasing | The create is refused as already existing. The writer retries after the old claim is gone. | @@ -855,6 +890,14 @@ tests for concurrency, authorization, lifecycle and recovery. - **Which identities are providers, realizers and break-glass operators, and which projects are provider projects.** Each cell's admission rules need them named, per environment. +- **The boot network's gateway and subnets at each site.** The site router + relays DHCP from the boot network's gateway address, and the central server + tells sites apart by subnet. Someone must decide whether NSO's boot network + is the source the router and the central server are configured from, or the + other way round, and who keeps them in step. +- **Routing from the boot network to the central cluster.** Each site router + must route the boot network to the central DHCP and boot file servers and to + nothing else. Network operations must agree to own that route. - **Fleet sets `purpose: Boot`.** NSO knows a boot claim from that field, not from the network it names. Fleet must agree to set it on each boot claim. - **A port NSO cannot release.** This design proposes a break-glass group that From 259e3c6dcd8ef0dd7130fd4bb763f4a3d111e5c8 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 20:26:11 -0600 Subject: [PATCH 08/11] docs: Name the boot return route and gateway Re-review noted the central cluster also needs a route back to each site's boot subnet, and that the router must sit at the gateway address NSO picks. Key changes: - state that NSO's gateway is the address after the subnet start - require a return route from the central cluster to each boot subnet - name what Fleet waits on when the central servers are unreachable Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index cdea2d0b..aee31b09 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -692,18 +692,20 @@ around it must hold for a relayed boot to work: - **The site router is the boot network's gateway.** The router relays DHCP from the gateway address of the boot network's subnet at that site, and the - central server picks the site's subnet by that relay address. The gateway NSO - reports on a boot claim must therefore be the router's address on the - provisioning VLAN. + central server picks the site's subnet by that relay address. NSO reports as + the gateway the address after the start address of the location's subnet, so + the router must hold that address on the provisioning VLAN and relay from it. - **Each site's boot subnet is distinct.** One central server serves every site, so two sites whose boot subnets overlap would look the same to it. The provider must give the boot network a subnet in each location that overlaps no other location's. -- **The boot network routes to the central cluster.** Firmware sends every - request beyond its own subnet through the gateway. The site router must route - the boot network to the central DHCP and boot file servers and to nothing - else, as Fleet's proposal already asks network operations to do for the - site's DHCP service. +- **The boot network and the central cluster route to each other.** Firmware + sends every request beyond its own subnet through the gateway, so the site + router must route the boot network to the central DHCP and boot file servers + and to nothing else. Replies travel the other way: a relayed DHCP reply goes + back to the router's relay address, and boot file traffic back to the + server's own address. The central cluster therefore needs a route back to + every site's boot subnet. A private segment still works. A server on a private segment reaches the network's gateway, which is the router, and every relayed request and boot file @@ -853,7 +855,7 @@ Where the design differs, NSO's model points somewhere better: | The realizer restarts while changing a port | It recomputes what each port carries from the holds and claims, and changes the port again if a claim has a deletion timestamp. | | The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or a break-glass operator removes it. | | NSO is down | No new claim binds and no claim releases. Ports keep what they carry. Fleet's proposal holds installs, wipes and releases until NSO returns. | -| The central DHCP or boot file servers are unreachable from a site | NSO is unaffected. A boot claim stays `Programmed`, since the port carries the boot network, and the install waits on Fleet's own DHCP evidence. Releasing the boot claim works as usual. | +| The central DHCP or boot file servers are unreachable from a site | NSO is unaffected. A boot claim stays `Programmed`, since the port carries the boot network. In Fleet's proposal the server is powered on only after DHCP reports its reservation served, so the install waits. Releasing the boot claim works as usual. | | IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | | IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | | A claim is recreated under a name whose claim is still releasing | The create is refused as already existing. The writer retries after the old claim is gone. | @@ -895,9 +897,11 @@ tests for concurrency, authorization, lifecycle and recovery. tells sites apart by subnet. Someone must decide whether NSO's boot network is the source the router and the central server are configured from, or the other way round, and who keeps them in step. -- **Routing from the boot network to the central cluster.** Each site router - must route the boot network to the central DHCP and boot file servers and to - nothing else. Network operations must agree to own that route. +- **Routing between the boot network and the central cluster.** Each site + router must route the boot network to the central DHCP and boot file servers + and to nothing else, and the central cluster must route back to every site's + boot subnet. Network operations, and whoever runs the central cluster, must + agree to own each direction. - **Fleet sets `purpose: Boot`.** NSO knows a boot claim from that field, not from the network it names. Fleet must agree to set it on each boot claim. - **A port NSO cannot release.** This design proposes a break-glass group that From 864b6d1b2253259ba99eb2f796c93d2fc265f599 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 21:40:21 -0600 Subject: [PATCH 09/11] docs: Map Fleet's boot attachment API shapes Fleet's boot attachment work assumes six NSO API shapes that NSO does not have yet. The design now says which it adopts, which it changes, and which it rejects, and why. Key changes: - adopt the Physical mode, typed attachment point and handover rules - know a boot claim by purpose and read its address by family - reject a claim-to-IPAM link; the claim's absence confirms release - add the Fleet changes this implies to the decisions Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 71 ++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index aee31b09..183bae17 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -318,6 +318,9 @@ spec: The new fields have no server-side defaults. A writer that compares the claim it reads back with the claim it wrote, as Fleet does, sees no field it did not set. +The attachment point is read only from these typed fields. NSO ignores any +annotation that names a MAC address, switch or port. + ### Boot claims and network claims A physical claim is one of two kinds: @@ -618,6 +621,13 @@ then is refused as already existing, and the writer retries once the old claim is gone. Naming a boot claim from its operation means a new operation never needs an old operation's name. +The claim's absence is the whole contract for a release. A provider confirms an +address is free by finding the claim gone, not by reading IPAM itself. The +names NSO gives its IPAM claims are internal. An address can already be held +under either of two names, one of them specific to the location, and NSO may +change how it names them. NSO checks every name an address can be held under +before it lets the claim go. + The verified release in step 4 applies to physical claims only. Today, for every mode, NSO finds each IPAM claim, deletes it, and removes its own finalizer without reading the IPAM claim again. Extending step 4 to compute's @@ -671,7 +681,10 @@ there. - **Addresses.** A boot claim's address comes from IPAM through NSO, like any claim's. The provider chooses the boot network's address families. Firmware - usually needs IPv4. + usually needs IPv4. Once bound, the claim reports the address in + `status.addresses`, one entry per family, each with its `family`, `address` + and `gateway`. A reader picks the entry by `family: IPv4`, not by its place + in the list, because the list's order is not part of the contract. - **Lifetime.** The provider names a boot claim from the operation it serves, creates it before the operation starts and deletes it when the operation ends. NSO adds no lifetime of its own. @@ -824,10 +837,8 @@ not an agreed contract. Where the design differs, NSO's model points somewhere better: -- **Knowing a boot claim.** If NSO took precedence from the network a claim - names, it would need a way to mark a network as a boot network, and any - project can write its own networks. `purpose: Boot` sits on a claim that only - providers can write, in a namespace only providers may use for it. +- **Knowing a boot claim.** See + [the API shapes Fleet's boot attachment work assumes](#the-api-shapes-fleets-boot-attachment-work-assumes). - **The boot address.** NSO allocates through IPAM for every claim, so a boot claim without an address would be a special case in NSO that Fleet would drop again. Both pieces of NSO land together, so there is no time when NSO attaches @@ -841,6 +852,49 @@ Where the design differs, NSO's model points somewhere better: delivers at least one of them tagged. Without the tag, the installer cannot configure that interface. +### The API shapes Fleet's boot attachment work assumes + +Fleet's boot attachment work, built against a test realizer and off by +default, assumes six NSO API shapes. None of them is an agreed contract. + +| Fleet assumes | This design | Verdict | +|---|---|---| +| 1. A `Physical` attachment mode for a bare-metal server | [The Physical attachment mode](#the-physical-attachment-mode) | Adopted as is | +| 2. The NIC's MAC address, switch and port on the claim, passed as annotations today | Typed, validated, immutable fields in `spec.attachmentPoint`. Annotations are ignored. | Adopted, with typed fields replacing the annotations | +| 3. A boot attachment claim on a provider-owned boot network, isolated between servers, that puts the port on the boot network while it exists and reports `Programmed` | A physical claim with `purpose: Boot`, private by default, accepted only in a provider project | Changed. NSO knows a boot claim from `purpose: Boot`, not from the network it names. | +| 4. The bound provisioning address in the claim's status, read as the first IPv4 entry | `status.addresses`, one entry per family | Changed. Read the entry whose `family` is IPv4, not the first entry. | +| 5. NSO keeps the claim until the port is detached, then releases the address, with a stable link from the claim to its IPAM claim so Fleet can confirm the address is free | [Releasing a physical claim, and proving it](#releasing-a-physical-claim-and-proving-it) | Release adopted. The IPAM link is rejected. The claim's absence is the confirmation. | +| 6. A port's membership follows its claims. A boot claim puts the port on the boot network only, with customer claims prepared but not programmed. Otherwise the port carries the customer networks. Each change is one step. | [What a port carries](#what-a-port-carries) and [the realizer's rules](#the-physical-realizer) | Adopted, with the realizer's safety rules added | + +The reasons for each change and rejection: + +- **Typed fields, not annotations.** A field can be validated, required for + `Physical`, frozen once written and kept out of the customer's copy of the + interface. An annotation can be none of those. Admission also limits who may + write the typed fields, and it cannot do the same for an annotation key + without matching every write to every claim. +- **Knowing a boot claim by its purpose.** Taking boot precedence from the + network a claim names would need a way to mark a network as a boot network, + and any project can write its own networks. `purpose: Boot` sits on a claim + only providers can write, in a namespace only providers may use for it. + Isolation follows the purpose, so Fleet gets an isolated boot claim without + setting anything else. +- **Picking the address by family.** NSO publishes one address per family and + promises nothing about their order. Reading the first entry works for a + claim that asks only for IPv4 and breaks quietly the day a boot network also + carries IPv6. +- **No IPAM link.** If Fleet also verified IPAM, two components would decide + when an address is free, and a change in NSO's naming would break Fleet + without a single NSO field changing. NSO already holds the claim until every + IPAM claim it could have used is gone and no IPAM allocation names one, so + the claim's absence already proves what the link was meant to prove. The + link would also have to name a resource in IPAM's own API, which is a + contract IPAM would have to agree to. +- **Safety rules on the handover.** Fleet's model of what a port carries is + NSO's. The realizer adds the steps that keep it honest when a switch + misbehaves: it withdraws `Programmed` before a change, reads the port back, + and keeps every detach finalizer until the read-back matches. + ## Failure and recovery | Failure | What happens | @@ -907,6 +961,13 @@ tests for concurrency, authorization, lifecycle and recovery. - **A port NSO cannot release.** This design proposes a break-glass group that may remove a detach finalizer after confirming the port on the switch. Who is in it, and who confirms the port, needs an owner. +- **Fleet relies on the claim's absence to confirm a release.** Fleet's boot + attachment work reads NSO's IPAM claim names to confirm an address is free. + This design keeps those names internal and makes the claim's absence the + confirmation. Fleet must agree to drop its IPAM check for NSO claims. +- **Fleet moves the attachment point from annotations to typed fields, and + reads the IPv4 address by family.** Both are changes to Fleet's boot + attachment work. - **Boot addresses from the first delivery.** Fleet plans an address-less boot claim and a separate IPAM claim at first. This design gives every boot claim its address from the start. Fleet must agree to skip the interim step, or ask From 415e468ccca1d423384658c5385ee8ed944c8569 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 21:42:08 -0600 Subject: [PATCH 10/11] docs: Scope the release contract honestly Re-review found the design said NSO already checks every IPAM claim name before releasing, which today's code does not, and that the absence contract ignored Retain. Key changes: - mark checking every IPAM claim name as new work in step 4 - scope claim absence as the release contract to Delete - name the ReleaseUnverified reason so a stuck release is diagnosable - say address order follows ipFamilies today but is not promised - note the gateway appears only once the location has a subnet Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 60 +++++++++++++++--------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index 183bae17..495bf372 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -598,16 +598,19 @@ When a physical claim is deleted: IPAM claims behind it. Under `Retain` it unbinds the interface, which keeps its addresses and stays off the port until a claim of the same name binds it again. -4. Under `Delete`, NSO reads each IPAM claim again, and lists the IPAM - allocations in the same IPAM namespace. The release is verified once each - IPAM claim is gone and no allocation's `spec.claimRef` names one. Under +4. Under `Delete`, NSO reads again every IPAM claim the address could be held + under, by each name it can carry, and lists the IPAM allocations in the + same IPAM namespace. The release is verified once every one of those IPAM + claims is gone and no allocation's `spec.claimRef` names any of them. Under `Retain`, IPAM keeps the allocations on purpose, so the release is verified once the interface is unbound. 5. NSO removes the claim's entry from the hold. 6. NSO removes its own finalizer, and the claim is gone. Until each step completes, the claim stays and its conditions say which step it -is waiting on. A hold entry whose claim no longer exists, read from the API +is waiting on. A release waiting on IPAM says so in its own reason, +`ReleaseUnverified`, apart from one waiting on the port, `AwaitingDetach`, and +its message names the address still held. It does not name NSO's IPAM claims. A hold entry whose claim no longer exists, read from the API server rather than a cache, is removed the next time NSO writes that hold, so an entry cannot outlive its claim. @@ -621,12 +624,17 @@ then is refused as already existing, and the writer retries once the old claim is gone. Naming a boot claim from its operation means a new operation never needs an old operation's name. -The claim's absence is the whole contract for a release. A provider confirms an -address is free by finding the claim gone, not by reading IPAM itself. The -names NSO gives its IPAM claims are internal. An address can already be held -under either of two names, one of them specific to the location, and NSO may -change how it names them. NSO checks every name an address can be held under -before it lets the claim go. +Under `Delete`, the claim's absence is the whole contract for a release. A +provider confirms an address is free by finding the claim gone, not by reading +IPAM itself. Under `Retain`, the claim's absence means the port no longer +carries the network, and the interface keeps its addresses for the next claim +of that name. + +The names NSO gives its IPAM claims stay internal. NSO can already hold an +address under either of two names, one of them specific to the location, and +may change how it names them. Today's release frees the first of those names it +finds and does not read IPAM back. Checking every name, as step 4 does, is new +work in this design. The verified release in step 4 applies to physical claims only. Today, for every mode, NSO finds each IPAM claim, deletes it, and removes its own @@ -682,9 +690,10 @@ there. - **Addresses.** A boot claim's address comes from IPAM through NSO, like any claim's. The provider chooses the boot network's address families. Firmware usually needs IPv4. Once bound, the claim reports the address in - `status.addresses`, one entry per family, each with its `family`, `address` - and `gateway`. A reader picks the entry by `family: IPv4`, not by its place - in the list, because the list's order is not part of the contract. + `status.addresses`, one entry per family, each with its `family` and + `address`, and its `gateway` once the location has a subnet. A reader picks + the entry by `family: IPv4`, not by its place in the list, and waits for the + gateway before it boots the server. - **Lifetime.** The provider names a boot claim from the operation it serves, creates it before the operation starts and deletes it when the operation ends. NSO adds no lifetime of its own. @@ -879,17 +888,20 @@ The reasons for each change and rejection: only providers can write, in a namespace only providers may use for it. Isolation follows the purpose, so Fleet gets an isolated boot claim without setting anything else. -- **Picking the address by family.** NSO publishes one address per family and - promises nothing about their order. Reading the first entry works for a - claim that asks only for IPv4 and breaks quietly the day a boot network also - carries IPv6. +- **Picking the address by family.** NSO publishes one address per family. + Today they follow the order of the claim's `ipFamilies`, but that order is + not promised, and this design adds that statement to the field's API + documentation. A reader that takes the first entry breaks quietly if a claim + ever lists IPv6 first. - **No IPAM link.** If Fleet also verified IPAM, two components would decide when an address is free, and a change in NSO's naming would break Fleet - without a single NSO field changing. NSO already holds the claim until every - IPAM claim it could have used is gone and no IPAM allocation names one, so - the claim's absence already proves what the link was meant to prove. The - link would also have to name a resource in IPAM's own API, which is a - contract IPAM would have to agree to. + without a single NSO field changing. Under this design NSO holds a physical + claim until every IPAM claim it could have used is gone and no IPAM + allocation names one, so the claim's absence proves what the link was meant + to prove. A stuck release names the address it is waiting on, so Fleet can + tell it from a stuck port without reading IPAM. The link would also have to + name a resource in IPAM's own API, which is a contract IPAM would have to + agree to. - **Safety rules on the handover.** Fleet's model of what a port carries is NSO's. The realizer adds the steps that keep it honest when a switch misbehaves: it withdraws `Programmed` before a change, reads the port back, @@ -925,7 +937,9 @@ tests for concurrency, authorization, lifecycle and recovery. 2. **Admission.** The rule that limits physical claims to provider identities, and the rule that limits removing the detach finalizer. 3. **Verified release.** NSO keeps a physical claim until IPAM confirms its - addresses are released. + addresses are released under every name they could be held under. The + claim reports `ReleaseUnverified` with the address still held, and the API + documentation for `status.addresses` says its order is not promised. 4. **Port holds and detach.** The `SwitchPortHold`, the binding order, waiting for a port, and the detach finalizer. 5. **Test realizer.** The realizer contract against a simulated switch, From 10e1f745c4e2ec6ff29f4ccd51961b6c49e2b397 Mon Sep 17 00:00:00 2001 From: Scot Wells Date: Wed, 25 Nov 2026 21:42:58 -0600 Subject: [PATCH 11/11] docs: Tie release reasons to Ready Re-review asked which condition carries the new release reasons and for the failure table to match them. Key changes: - carry AwaitingDetach and ReleaseUnverified on Ready while releasing - name ReleaseUnverified in the IPAM failure rows - rewrap the release paragraph Co-Authored-By: Claude Opus 5.5 --- docs/enhancements/physical-attachment.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/enhancements/physical-attachment.md b/docs/enhancements/physical-attachment.md index 495bf372..6c287aa7 100644 --- a/docs/enhancements/physical-attachment.md +++ b/docs/enhancements/physical-attachment.md @@ -608,11 +608,10 @@ When a physical claim is deleted: 6. NSO removes its own finalizer, and the claim is gone. Until each step completes, the claim stays and its conditions say which step it -is waiting on. A release waiting on IPAM says so in its own reason, -`ReleaseUnverified`, apart from one waiting on the port, `AwaitingDetach`, and -its message names the address still held. It does not name NSO's IPAM claims. A hold entry whose claim no longer exists, read from the API -server rather than a cache, is removed the next time NSO writes that hold, so -an entry cannot outlive its claim. +is waiting on. While a claim releases, `Ready` is false and its reason names the +step: `AwaitingDetach` while the detach finalizer is present, and +`ReleaseUnverified` while IPAM still holds an address. The `ReleaseUnverified` +message names the address still held. It does not name NSO's IPAM claims. NSO never releases an address while the detach finalizer is present. A claim whose realizer never answers therefore stays, with its addresses held, and that @@ -804,7 +803,7 @@ writer: | `Allocated` | NSO | Every requested family holds an address. | | `Prepared` | Realizer, on the interface and the claim | The realizer accepted the attachment point and can build its segment. | | `Programmed` | Realizer, on the interface and the claim | The port carries the claim's network. | -| `Ready` | NSO | All four are true. NSO derives it each time the claim changes. | +| `Ready` | NSO | All four are true. NSO derives it each time the claim changes. While the claim releases, its reason names the step it waits on. | The existing realizer for virtual interfaces writes `Ready` on a claim only to set it `Unknown` while it migrates an attachment. The physical realizer never @@ -922,8 +921,8 @@ The reasons for each change and rejection: | The realizer is down when a claim is deleted | The claim stays with its addresses held and the detach finalizer present, until the realizer returns or a break-glass operator removes it. | | NSO is down | No new claim binds and no claim releases. Ports keep what they carry. Fleet's proposal holds installs, wipes and releases until NSO returns. | | The central DHCP or boot file servers are unreachable from a site | NSO is unaffected. A boot claim stays `Programmed`, since the port carries the boot network. In Fleet's proposal the server is powered on only after DHCP reports its reservation served, so the install waits. Releasing the boot claim works as usual. | -| IPAM is unreachable during release | The claim stays, reporting the failed release, and NSO retries. | -| IPAM keeps an allocation after its IPAM claim is gone | The claim stays, reporting the allocation that remains. | +| IPAM is unreachable during release | The claim stays with `Ready=False` and reason `ReleaseUnverified`, and NSO retries. | +| IPAM keeps an allocation after its IPAM claim is gone | The claim stays with `Ready=False` and reason `ReleaseUnverified`, naming the address still held. | | A claim is recreated under a name whose claim is still releasing | The create is refused as already existing. The writer retries after the old claim is gone. | ## Delivery