Skip to content

feat(provider): compute the Docker gateway launch from typed settings - #12832

Merged
cv merged 2 commits into
feat/typed-managed-gatewayfrom
feat/gateway-runtime-data-source
Oct 8, 2026
Merged

cv merged 2 commits into
feat/typed-managed-gatewayfrom
feat/gateway-runtime-data-source

Conversation

@cv

@cv cv commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Part of #12785. Stacked on #12831.

Failure

Generated Docker gateway containers carried an entrypoint, command and env that only the SDK compiler knew how to write. An HCL author declaring a Docker gateway had to copy OpenShell gateway flags and data paths by hand.

Decision

  • nemoclaw_gateway_runtime takes the gateway name, its endpoint (an HTTP origin with a loopback address and an unprivileged port) and the data_path that nemoclaw_gateway_storage returns. It returns the container's entrypoint, command and env as lists, without contacting any host. This follows the other runtime contract data sources.
  • Invalid settings fail validation with a message naming the setting.
  • The SDK compiler and the data source share one launch definition, so the compiled Podman container and the data source's Docker output cannot drift apart.
  • Generated graphs take the Docker gateway container's launch from the data source, fed the storage's data_path.
  • The provider guide documents the data source with an example and lists the container settings generated graphs add.

Validation

  • A new end-to-end test writes a Docker gateway in HCL through pinned OpenTofu and checks the planned launch. It also checks that invalid settings fail. It failed against the previous bundle ("Invalid data source") and passes against a rebuilt one.
  • A unit test checks that the launch matches the compiled container and that invalid names, endpoints and data paths are rejected.
  • The SDK compile tests now check the generated data source and the references to it.
  • nemoclaw-sdk and nemoclaw-provider tests pass, as do the runtime contract and service storage end-to-end tests. Workspace clippy at -D warnings and fmt are clean. GitHub CI runs the full suite.

Generated Docker gateway containers carried an entrypoint, command, and
environment that only the SDK compiler knew how to write, so an HCL
author declaring a gateway had to copy OpenShell gateway flags and data
paths by hand.

nemoclaw_gateway_runtime takes the gateway's name, endpoint, and the
data path its storage returns, validates them, and returns the
container's entrypoint, command, and env. The SDK compiler and the data
source share one launch definition, and generated graphs take the
container's launch from the data source.

Part of #12785.
@cv cv added area: architecture Architecture, design debt, major refactors, or maintainability v1 NemoClaw v1 branch labels Oct 8, 2026
…12834)

Part of #12785. Stacked on #12832.

## Failure

`nemoclaw_runtime_image`, `nemoclaw_service_readiness` and
`nemoclaw_service_capacity` took SDK-compiled service specifications. An
HCL author could not check a runtime image, wait for a service
container, or measure capacity without reproducing the SDK's internal
JSON.

## Decision

- **`nemoclaw_runtime_image`** takes `engine`, `image` (pinned by
SHA-256 digest), `architecture` (`amd64` or `arm64`) and optional
`labels`, the labels the image must carry. `image_id` and
`allow_missing` keep their meaning.
- **`nemoclaw_service_readiness`** takes the container's `engine`,
`name` and `container_id`, and its `contract`: the `spec` output of the
`nemoclaw_vllm_runtime`, `nemoclaw_ollama_runtime` or
`nemoclaw_ollama_proxy_runtime` data source the container runs with. The
contract decides what readiness checks, including vLLM credential
permissions when it enables authentication.
- **`nemoclaw_service_capacity`** replaces `specs` with `contracts`, the
runtime contracts of the services on the engine. A contract listed twice
is rejected, replacing the old check for a repeated service name.
- Generated graphs pass these values. Readiness references the same
runtime contract data source as the container's environment.
- Provider internals now read readiness and capacity from the runtime
contract instead of the whole compiled specification.

## Validation

- **Readiness and capacity:** the standalone OpenTofu tests for
readiness and capacity now write the typed inputs. Readiness failed on
the previous schema ("Extraneous JSON object property") and both pass
now.
- **Schema:** a new provider schema test checks that all three data
sources take typed inputs and no `spec`.
- **Runtime image:** new unit tests cover validation of its requirements
and deferral of unknown values. The read-only image checks still pass.
- **Compiled graph:** the SDK compile tests check the generated
readiness `contract` references.
- **Suites:** `nemoclaw-sdk`, `nemoclaw-provider` and `nemoclaw-build`
tests pass, with workspace clippy at `-D warnings` and fmt. GitHub CI
runs the full suite.
@cv
cv merged commit f4f0ffb into feat/typed-managed-gateway Oct 8, 2026
2 checks passed
@cv
cv deleted the feat/gateway-runtime-data-source branch October 8, 2026 17:51
cv added a commit that referenced this pull request Oct 8, 2026
…#12831)

Part of #12785. Carries #12832 and #12834, which merged into this branch
while the PRs were stacked.

## Failure

Gateway resources and the service observation data sources took
SDK-compiled `spec` strings. To declare a gateway, check a runtime
image, wait for a service, or measure capacity in HCL, an author had to
reproduce the SDK's internal JSON, including layout numbers that encode
storage contract versions. Generated Docker gateway containers also
carried an entrypoint, command and environment that only the SDK
compiler could write.

## Decision

- **`nemoclaw_managed_gateway` and `nemoclaw_gateway_storage`** take
`name`, `compute_driver`, `engine`, `image`, `network_cidr` and
`endpoint` as attributes. `owner` and `generation` are optional,
computed and generated on create. The provider derives the internal
layout. Docker gateway storage rejects `endpoint`, because its data does
not depend on the listen port. The backend still builds the same
internal specification, so container and volume labels are unchanged.
The SDK reads the attributes back from OpenTofu state for bound
gateways.
- **`nemoclaw_gateway_runtime`** computes a Docker gateway container's
`entrypoint`, `command` and `env` from `name`, `endpoint` and the
storage's `data_path`. It shares one launch definition with the SDK
compiler. Generated graphs take the launch from it.
- **`nemoclaw_runtime_image`** takes `engine`, a digest-pinned `image`,
`architecture` and optional `labels`.
- **`nemoclaw_service_readiness`** takes the container's `engine`,
`name` and `container_id`, and its `contract`: the `spec` of the vLLM,
Ollama or Ollama proxy runtime data source the container runs with.
- **`nemoclaw_service_capacity`** takes `contracts` instead of `specs`
and rejects a contract listed twice.
- The provider guide documents each input. `docs/limits.md` now lists
only the Kubernetes types as taking a compiled `spec`.

The merge from `v1` keeps #12842's removal of the `nemoclaw` provider's
gateway settings. The authored HCL in the end-to-end tests uses an empty
`provider "nemoclaw"` block.

## Validation

- **Gateway resources:** a provider schema test checks their typed
attributes. Attributes round-trip to the internal specification for both
drivers, and invalid values are rejected. State bindings record typed
settings, including the null endpoint of Docker gateway storage.
- **End-to-end through pinned OpenTofu:**
  - The prerequisite protocol test writes the gateway in HCL.
- A Docker gateway written in HCL plans its launch through
`nemoclaw_gateway_runtime`.
  - The readiness and capacity tests use the typed inputs.
- **After merging `v1`:**
- `nemoclaw-sdk`, `nemoclaw-provider` and `nemoclaw-build` pass 776
tests.
- The standalone OpenTofu tests (24), the production provider tests and
the capacity test pass.
  - Workspace clippy at `-D warnings` and fmt are clean.
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images security area: security Security controls, permissions, secrets, or hardening and removed security labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Architecture, design debt, major refactors, or maintainability area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: container Affects Docker, containerd, Podman, or images v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants