Skip to content

Add netSoftnetExpose to the VM spec and refuse exposed-port conflicts on a worker - #484

Open
stratakis wants to merge 3 commits into
openai:mainfrom
stratakis:net-softnet-expose
Open

Add netSoftnetExpose to the VM spec and refuse exposed-port conflicts on a worker#484
stratakis wants to merge 3 commits into
openai:mainfrom
stratakis:net-softnet-expose

Conversation

@stratakis

Copy link
Copy Markdown

Softnet can forward host ports to a VM (tart run --net-softnet-expose), but Orchard had no way to ask for it, so a VM behind Softnet was reachable only through the controller's SSH proxy.

  • netSoftnetExpose on the VM spec, validated the way Softnet parses it, exposed in orchard create vm and orchard get vm.
  • The scheduler skips a worker that already exposes a requested port, re-checked inside the scheduling transaction; changing the ports of a scheduled VM is refused with 412.

I wrote this before #478 and ran it on an Apple silicon host with Testing Farm's Artemis driver. Now that endpoints exist I am moving to them, so this is here only in case Softnet-level forwarding is worth having on its own and I didn't wanna throw that work away but if you feel it's not worth having it feel free to close it.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de530fd6e0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/controller/api_vms.go
Comment thread internal/controller/scheduler/workerinfo.go Outdated

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two-level conflict check is the right ownership model: the lagging WorkerInfos view filters obvious conflicts, then the scheduling transaction rechecks current VM state before assignment. Reusing the same external-port conflict helper for scheduled spec edits also keeps API and scheduler semantics aligned, including canonical forms such as 02222 versus 2222. The leading-zero regression is worth retaining because a textual comparison here would be easy to reintroduce.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ef76a41c8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/controller/scheduler/scheduler.go Outdated
Comment thread pkg/resource/v1/v1.go
Comment thread internal/controller/scheduler/workerinfo.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7b3fc09b1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread pkg/resource/v1/v1.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ec251c5f6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/controller/scheduler/workerinfo.go
Comment thread internal/tests/spec_update_test.go Outdated
Comment thread api/openapi.yaml Outdated
Softnet can forward host ports to a VM, but Orchard had no way to ask for
it, so a VM behind Softnet was reachable only through the controller's
SSH proxy.
Register the workers with the notifier as well, otherwise every placement
waits a second for its worker to connect.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 060665b84d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/controller/scheduler/workerinfo.go Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf0410d2c1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/controller/scheduler/workerinfo.go Outdated
Two VMs exposing the same external port on one worker both reach the
running state, and the second silently does not get the port. Endpoint
listeners take worker ports too, so they count on both sides, and a
scheduled VM's ports cannot change while the worker still has them bound.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2bf9cec9f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return true
}

takenPorts[port] = struct{}{}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce the hypothetical range-port assignment

When a scheduled endpoint is still pending in range 2222–2223 and a later Softnet VM requests 2222, this accepts the placement by hypothetically assigning 2223 to the endpoint. The new evidence is that the selected port is recorded only in this local takenPorts map; the actual listener independently scans upward from the range minimum (internal/worker/endpoint/endpoint.go:84-93). If that endpoint starts first, it can therefore bind 2222 and make the later Tart launch fail despite the scheduler having accepted both VMs. Persist the selected port or otherwise make the worker honor the scheduler's reservation.

Useful? React with 👍 / 👎.

Comment thread pkg/resource/v1/v1.go
Comment on lines +194 to +198
for _, endpoint := range vm.Endpoints {
portRange := endpoint.WorkerPortRange

if portRange == nil || portRange.HasFreePort(seenExternalPorts) {
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate endpoint ranges as a joint allocation

When one VM exposes Softnet port 2222 and declares two endpoints whose ranges are both 2222–2223, each endpoint independently sees 2223 as free and validation succeeds. The scheduler's joint range matching then correctly determines that two listeners cannot share that sole remaining port, so every worker is rejected and the accepted VM remains pending indefinitely. Consume distinct free ports while validating all of the VM's endpoint ranges so this intrinsic specification conflict is rejected by the API.

Useful? React with 👍 / 👎.

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