Skip to content

Add a Prepared condition, and attachmentMode on the claim - #393

Merged
scotwells merged 2 commits into
mainfrom
feat/consumer-annotations-attachment-mode
Aug 21, 2026
Merged

Add a Prepared condition, and attachmentMode on the claim#393
scotwells merged 2 commits into
mainfrom
feat/consumer-annotations-attachment-mode

Conversation

@scotwells

@scotwells scotwells commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Two additions that let a consumer attach an instance to a tenant VPC without knowing anything about networking. NSO carries both and interprets neither.

Prepared, on the claim and the interface

The data plane's pre-workload artifacts exist, so a workload consuming this interface can be created. Owned by whoever realizes the interface, seeded Unknown and then left alone, exactly as Programmed already is.

The distinction between the two conditions is the point, and getting it backwards deadlocks the platform. Prepared becomes true before any workload exists, which is what makes waiting on it safe. Programmed only becomes true when the interface is attached, which happens while the workload's sandbox is being created — so a consumer that withholds the workload until Programmed is true waits for something its own waiting prevents. That is stated on both condition constants and in the enhancement, because the next person to gate on one of them will read one of the two.

Ready now derives from Bound + Allocated + Prepared + Programmed. The existing survival test is extended to walk both conditions in order rather than a parallel test being added.

NetworkInterfaceClaim.spec.attachmentMode

Netns or Hypervisor, defaulting to Netns, copied verbatim onto NetworkInterface.spec.attachmentMode at fulfillment. It says how the guest consumes the NIC — placed in a network namespace, as an ordinary container expects, or handed to a hypervisor as a device, as a virtual machine or microVM guest needs. It names no CNI, no Multus and no Linux device type, so it stays meaningful on a platform that has none of those. Immutable on the claim, because both the guest and the attachment are built against it.

Nothing sets it to Hypervisor yet. The first consumer is a VPC controller that takes the value from its own required configuration, standing in for a compute capability class that does not exist as an API yet.

Withdrawn from an earlier revision of this PR

NetworkInterface.status.consumerAnnotations is gone. It put an instruction in a status field, assumed the consumer was a Kubernetes Pod, and its opacity was fiction — the value was k8s.v1.cni.cncf.io/networks in plain sight on a published API, so every reader learned Multus exists whether or not their code was typed against it. A typed reference to the NAD was considered and rejected too: it compresses the same knowledge into a kind-to-mechanism switch, and once a mutating webhook exists the field has no external reader. Delivery now happens in a Pod admission webhook served by the VPC controller, and NSO's API carries no CNI vocabulary of any kind.

Tests

make lint clean. All non-e2e packages pass.

internal/controller was at the edge of Go's 10m per-package default before this work and is the reason to keep an eye on new envtest cases: it now runs in 537s, back inside the limit. Dropping the withdrawn field's test is what recovered the margin — this revision adds no new envtest case, extending an existing one instead.

Related

🤖 Generated with Claude Code

NetworkInterface.status.consumerAnnotations carries the annotations the
workload object needs for the data plane to deliver the interface,
written by whoever realizes it and opaque to NSO.
NetworkInterfaceClaim.spec.attachmentMode says whether the guest takes
the NIC through a network namespace or a hypervisor, and is copied
verbatim onto the interface.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An opaque annotation map put an instruction in a status field and named
a CNI on a published API in all but type. Delivery moves to a Pod
admission webhook served by the data plane, so NSO's API carries no CNI
vocabulary at all. Prepared reports that the data plane's pre-workload
artifacts exist, which is the condition a consumer can safely gate
workload creation on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@scotwells scotwells changed the title Publish what a consumer must apply, and how the guest consumes the NIC Add a Prepared condition, and attachmentMode on the claim Aug 21, 2026
@scotwells
scotwells requested a review from privateip August 21, 2026 00:48
@scotwells
scotwells marked this pull request as ready for review August 21, 2026 00:48
@scotwells
scotwells enabled auto-merge August 21, 2026 00:48
@scotwells
scotwells merged commit 6cf39f0 into main Aug 21, 2026
13 checks passed
@scotwells
scotwells deleted the feat/consumer-annotations-attachment-mode branch August 21, 2026 01:25
scotwells added a commit to datum-cloud/compute that referenced this pull request Aug 21, 2026
…merged

datum-cloud/network-services-operator#393 is merged, so the pin no longer
targets an unmerged branch. The latest tag still predates the Prepared
condition, so this stays a main pseudo-version until a release carries it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants