Skip to content

feat(openshell-provider): grant sandboxes verified cluster Service addresses - #13128

Merged
cv merged 1 commit into
v1from
feat/openshell-cluster-model-checks
Oct 14, 2026
Merged

cv merged 1 commit into
v1from
feat/openshell-cluster-model-checks

Conversation

@cv

@cv cv commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

An OpenShell provider profile can now carry a verified cluster source, and a sandbox policy can grant that cluster Service's verified addresses. The bundled providers use DockerServices, which rejects every cluster source, so Docker and Podman deployments are unchanged until a cluster Services implementation is injected (#13063).

Why

#12736 routes sandboxes to vLLM and Ollama Pods that the deployment runs in its cluster. A cluster model is reached by a <name>.svc.cluster.local host, so an inference profile, which grants only the literal IP in its endpoint URL, could not grant the Service's ClusterIP, and nothing checked which Service owned the address.

What changes

  • Services hook: adds validate_cluster_source and cluster_addresses to the trait from refactor(openshell-provider): inject credential services into the OpenShell and Fabric providers #13127. DockerServices returns BindingMismatch from both.
  • Cluster profiles: openshell_provider_profile gains an optional, computed cluster_source.
    • It is a bound field (feat(tofu): reject refreshes that change a bound field #13126) and resets to empty when omitted on update, so any change replaces the profile.
    • nemoclaw_openshell::profile::cluster_definition accepts only an http://<host>.svc.cluster.local:<port>/v1 endpoint without credentials, query, or fragment, and grants only the addresses Services::cluster_addresses returns.
    • service_address_allowed rejects unspecified, loopback, multicast, link-local, broadcast, and IPv4-mapped addresses.
    • The source and addresses are stored in new nemoclaw.nvidia.com/cluster-source and cluster-addresses annotations. Refresh re-reads the addresses and rejects a profile whose endpoints no longer match them.
  • Cluster grants: PolicyInput.cluster_grants names managed rules whose allowed_ips come from verified cluster profiles (RuntimeBinding::granted_policy: one or two unique /32 or /128 addresses per rule). Sandbox create (create_sandbox_request) and refresh (checked_sandbox_row_with) check each grant against the deployment's own profile: same owner, listed among the sandbox's providers, and the same endpoint apart from allowed_ips. Removal checks only the recorded policy, so it works when the Service is gone. The field is omitted from serialized policy when empty.
  • SDK: image_runtime::policy_input sets cluster_grants: Default::default().

Breaking or user-visible changes

  • Provider schema: openshell_provider_profile gains cluster_source, and the openshell_sandbox policy block gains cluster_grants. With the bundled DockerServices, a profile with cluster_source or a sandbox with cluster_grants fails on create and read (docker_services_reject_cluster_profiles).
  • State and annotations: no change for existing resources. cluster_grants is not serialized when empty, and a profile without a cluster source writes no new annotations.
  • Rust API: nemoclaw_openshell::runtime::PolicyInput gains the public cluster_grants field, so struct literals need it. The crates are publish = false.

Validation

cargo ci passed on this tree (linux_amd64): 1462 tests and 136 lifecycle tests.

New tests:

Test Checks
nemoclaw-provider refresh::profile_refresh_preserves_the_bound_cluster_source Fails on v1 before this PR: state becomes substituted-service.
refresh::changing_from_cluster_to_external_inference_replaces_the_owned_profile Fails on v1 before this PR: planned cluster_source stays owned-cluster-storage.
nemoclaw-openshell profile::tests::cluster_profiles_accept_only_plain_service_endpoints_and_unicast_addresses Endpoint shape and address filter.
openshell-provider profile::tests::docker_services_reject_cluster_profiles Bundled default rejects cluster sources.
owned_cluster_profiles_grant_exact_observed_addresses_and_reject_others Exact /32 and /128 grants; no broader observed grant.
cluster_grants_resolve_the_endpoint_ambiguity_with_the_provider_profile Without the grant, OpenShell reports one endpoint ambiguity; with it, none.
profile_removal_validates_recorded_grants_when_the_service_is_absent Refresh needs the Service; removal does not, but still rejects a broadened grant.
cluster_sandbox_grants_require_the_matching_owned_profile_and_exact_host_addresses Grant count, prefix, uniqueness, owner, provider listing, endpoint.
sandbox_refresh_verifies_current_grants_but_removal_uses_recorded_policy Moved or absent Service fails refresh; removal checks only recorded policy.
fabric-provider configured_provider_observes_cluster_grants_through_its_injected_services FabricProvider::with_services keeps the cluster methods.

Each production check was mutated once, and a new test failed each time: the granted_policy address filter, cluster_grant endpoint equality, the sandbox refresh grant comparison, the profile refresh endpoint comparison, the .svc.cluster.local host check, and the validate_cluster_source call.

The openshell-provider tests build the cluster case from the fabric-openclaw contract fixture, so they need no SDK types. #13063 can keep or replace them with its SDK-built cases.

Split from #13060 (Hai Nguyen's work; co-authored). Follows #13125, #13126, and #13127.

…dresses

A cluster model is reached by a <name>.svc.cluster.local host, so a sandbox
policy could not grant its ClusterIP, and nothing checked which Service owned
the address. The Services hook gains validate_cluster_source and
cluster_addresses; DockerServices rejects both, so the bundled providers
reject every cluster source until a cluster implementation is injected.

- openshell_provider_profile gains an optional, bound cluster_source. Its
  profile accepts only an http://<host>.svc.cluster.local:<port>/v1 endpoint
  and grants only unicast Service addresses the hook returns; refresh
  re-reads the addresses and rejects a profile whose grant no longer matches.
- The sandbox policy gains cluster_grants: managed rules whose allowed_ips
  come from the deployment's own verified cluster profile. Create and
  refresh check each grant; removal checks only the recorded policy.

Split from #13060, with unit tests for the cluster profile and grant checks.

Co-authored-by: Hai Nguyen <haingu@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 29408b9 into v1 Oct 14, 2026
@cv
cv deleted the feat/openshell-cluster-model-checks branch October 14, 2026 01:43
gaveezy added a commit that referenced this pull request Oct 14, 2026
PR-6 and PR-7 merged v1 after #13060 was closed in favor of #13125,
#13126, #13127, and #13128. This merge brings v1's versions of that
code into PR-8; git merged it without conflicts.

#13128 added SDK-free cluster tests to the `tests` module of
`crates/openshell-provider/src/profile.rs`, next to PR-8's tests built
from the SDK. Four names are now defined twice there, so that module
does not compile at this commit. The next commit resolves them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gaveezy added a commit that referenced this pull request Oct 14, 2026
## Why

Merging PR-7 brought in the SDK-free cluster tests that #13128 added to
the `tests` module of `crates/openshell-provider/src/profile.rs`. PR-8
defines `cluster_case` and three tests with the same names in that
module, so its library tests did not compile: E0428 for the 4 names,
and E0061 at the 6 zero-argument `cluster_case()` calls.

## Change

- Remove `owned_cluster_profiles_reject_non_service_addresses`. Its
  three addresses are among those that #13128's
  `owned_cluster_profiles_grant_exact_observed_addresses_and_reject_others`
  rejects, through the same `service_address_allowed` check in
  `cluster_definition`. It asserts nothing about the rows the SDK
  compiles.
- Rename PR-8's `cluster_case(example)` to `sdk_cluster_case`, and add
  an `sdk_` prefix to the three tests whose names #13128 also uses:
  `profile_removal_validates_recorded_grants_when_the_service_is_absent`,
  `cluster_sandbox_grants_require_the_matching_owned_profile_and_exact_host_addresses`,
  and `sandbox_refresh_verifies_current_grants_but_removal_uses_recorded_policy`.
  They run on the rows the SDK compiles from
  `examples/kubernetes/local-vllm.yaml` and `local-ollama.yaml` and
  assert that the provider accepts them. #13128's fixture rows cannot
  check that, so the tests stay.

Production code is unchanged.

## Validation

- Without this commit, `cargo test -p openshell-provider --lib`
  failed to compile with the 10 errors above. With it, the 51
  `openshell-provider` library tests pass, and `cargo fmt --check` and
  `cargo clippy -p openshell-provider --tests -- -D warnings` pass.
- Allowing broadcast or IPv4-mapped addresses in
  `service_address_allowed`, or skipping the address check in
  `cluster_definition`, failed the removed test and #13128's test
  alike.
- Not recording sandbox cluster grants in the SDK's `policy_input`
  failed `sdk_cluster_sandbox_grants_...`,
  `sdk_sandbox_refresh_...`, and
  `cluster_sandbox_create_request_is_accepted_beside_its_provider_profile`.
  Not emitting `cluster_source` in the SDK's `inference_targets` also
  failed `sdk_profile_removal_...`. #13128's tests and the removed test
  passed under both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wscurran wscurran added area: policy Network policy, egress rules, presets, or sandbox policy area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: k8s Affects Kubernetes deployments v1 NemoClaw v1 branch labels Oct 22, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: policy Network policy, egress rules, presets, or sandbox policy area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: k8s Affects Kubernetes deployments v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants