Repository navigation
test(kubernetes): cover managed-gateway OIDC and three agents on one in-cluster route - #13484
Merged
Merged
Conversation
…in-cluster route ## Failure #12734 asks for unit and fixture coverage of managed-gateway OIDC authentication, token refresh and authentication failures, and of per-agent identity and routing for agents that use cluster-local inference. The Kubernetes gateway code that #13414 and #13063 added had little of either. **OIDC.** Every SDK Kubernetes operations and connect test used the development profile, so the `oidc` branches from #13414 had no unit or fixture test: the auth resource identified by its namespace once ready, no issuer objects or signing material, and the token read from the variable `tokenEnv` names. The forwarded fake-gateway tests always supplied the token the gateway expected. Only the live `kubernetes_live::oidc` test refuses a token on the managed Kubernetes path, and it checks neither the error class nor that nothing changed. **Several agents on an in-cluster model.** `kubernetes_inference` covered one sandbox, from the `local.yaml` fixture. No test checked per-agent names or routes for the three-agent cluster examples: `example_configurations_are_valid_fabric_configurations` compiles them only to validate their Fabric configurations. The #13063 commit message names catalog-skip tests, such as `kubernetes_inference::cluster_gateways_read_no_model_catalog_for_a_cluster_service`, that v1 does not have. ## Decision These tests characterize existing behavior; no production code changes. ### OIDC - `kubernetes_operations`: with an `oidc` spec, `ensure` of the auth resource adds no cluster objects and no local signing material. `read` reports no identity before the resource is ready, and the namespace UID after. - `kubernetes_connect`: `running` takes the spec to prepare from. A connection's token equals the value of the variable `tokenEnv` names, and no state file contains it. When that variable is unset or empty, `connect` fails with the `tokenEnv` message. - Tests can't safely set a variable while others run, so `tokenEnv` names variables that Cargo and nextest set for every test process: `CARGO_MANIFEST_DIR` holds a token, and `CARGO_PKG_LICENSE_FILE` is empty because the package declares an SPDX license. `PATH`, the precedent in `fake_gateway_tests`, can't be used: the schema forbids it as `tokenEnv`, so the operations refuse the spec with `Query` before `connect` reads a token. - `fake_gateway_tests`: the `Forward` stub's token is now a field, and `Forward::client` opens a new `GatewayClient`. A gateway that requires a fresh token refuses every call with a stale one, so nothing changes, and the provider reports `ObservationError::Authentication` without state. That variant carries no gateway text, so it can't echo the token. A new client with the fresh token then succeeds, as the next command's provider process would; a `GatewayClient` keeps its client for the process's lifetime. No test changes a variable's value between commands. That a refreshed token takes effect on the next command follows from these tests and `an_existing_issuers_token_reaches_gateway_only_runs`, which resolves `tokenEnv` into OpenTofu's environment on each command. ### Three agents on one in-cluster route `three_agents_on_a_cluster_gateway_share_one_service_registration_with_their_own_rules` compiles `examples/kubernetes/external-gateway.yaml` and `examples/openshift/external-gateway.yaml` with the provider endpoint set to `http://qwen.models.svc.cluster.local:8000/v1`. It checks: - one `openshell_inference` whose server is the Service endpoint with the example provider's credential, and no `cluster_source`; - in each of the three sandboxes, an FQDN rule for the Service's host, port and `/v1/**`, without `allowed_ips` or `cluster_grants`; - one `fabric_agent` per sandbox, named by that sandbox's `agent.name`, whose models use the Service as `base_url`; - the same graph with `spec.sandboxes` reversed. `examples/kubernetes/managed-development.yaml` keeps its hosted endpoint, because its explicit policies name it, and is checked only for agent names. The test reads agent names from each document: `main` in the external examples, `primary` in managed-development. `a_cluster_service_endpoint_reads_no_catalog_while_https_and_private_addresses_keep_theirs` pins the skip that #13063 landed in `endpoint_requests`: an endpoint that fails `validate_endpoint`, such as plain HTTP to a Service name, has no catalog request, while an HTTPS endpoint and plain HTTP to `10.0.0.5` each keep one. The rule lookup and the expected Service rule endpoints move into helpers that the single-sandbox test also uses. Its assertions are unchanged. ## Validation The tests passed when added. If one fails later, the fix belongs in its own PR, with that test as its failing test. - `cargo ci` passed: tools, fmt, clippy, build, test (1606 passed), schema, bundle, and lifecycle (150 passed), within budget. - `cargo nextest run -p nemoclaw-sdk -E 'test(/kubernetes_connect|kubernetes_operations|kubernetes_inference|inference_discovery/)'` and `cargo nextest run -p openshell-provider --lib` pass. - `cargo test -p nemoclaw-sdk --test integration` on the three new OIDC tests passes, so both Cargo variables are set under `cargo test` too. - Each key assertion failed against a temporary change, since reverted. - OIDC inputs and fixtures: development auth on `ensure`; an existing auth directory; a receipt already marked ready; `tokenEnv` naming another variable; the token copied into the state directory; a set variable in the missing-token test; a missing client TLS Secret; the stale forward supplying the fresh token; a gateway accepting any token; a new client with a third token. - Production mutations: `operations.rs` identifying the `oidc` auth resource by its first issuer object; `operations.rs` accepting an empty token; `Mutation::failed` carrying state; no credential on a registration that several sandboxes share. - Routing inputs: a second registration, another Service port, a `cluster_source`, a cluster grant or `allowed_ips` on one sandbox, agents named after their sandboxes (also for managed-development alone), another model `base_url`, agent metadata that depends on sandbox order, no validation skip, rejected private HTTP, and skipped HTTPS. - Deferred to CI: `cargo ci live-docker` and `cargo ci live-kind`, which `cargo ci` selects because `openshell-provider` changed. Docker isn't installed on this host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
v1 documentation preview: https://nvidia-preview-nemoclaw-v1-pr-13484.docs.buildwithfern.com/nemoclaw |
cv
enabled auto-merge (squash)
October 19, 2026 22:04
cv
added a commit
that referenced
this pull request
Oct 19, 2026
…fig (#13501) ## Failure With `gateway.kubernetes.authentication.profile: oidc`, NemoClaw took OpenShell's OIDC settings as its own fields (`issuer`, `audience`, `rolesClaim`, `adminRole`, `userRole`, `scopesClaim`) and copied them into the chart's `openshell.gateway.oidc` table. It also added `jwks_ttl_secs` and `dangerously_allow_insecure_http`. Each new OpenShell OIDC setting needed a NemoClaw field. NemoClaw's docs also misdescribed OpenShell's behavior: omitting both roles applies OpenShell's default roles, not "any valid token" (#13495). ## Decision - **Where the settings live:** the `oidc` profile takes `openshell.gateway.oidc` from `spec.gateway.config` (#13492), in OpenShell's names, exactly as OpenShell's [gateway authentication guide](https://github.com/NVIDIA/OpenShell/blob/5a7728c304b5528e954e9ae900cf21f84e1a12b1/docs/how-it-works/gateways/authentication.mdx#oidc) documents for Helm. The table reaches the chart as written. - **What NemoClaw keeps:** `profile`, the `token` reference it uses to reach the gateway, and `caConfigMap`, a chart value rather than gateway configuration. - **Validation:** - plan requires the table, in either the dotted or the nested form; - under `development` it still rejects the table, since NemoClaw writes it for its own issuer; - NemoClaw no longer checks the issuer URL's shape or the pairing of roles; OpenShell validates its table. - **Values NemoClaw added:** dropping them changes nothing, because OpenShell's defaults for `jwks_ttl_secs` (3600) and `dangerously_allow_insecure_http` (false) are the same. - No backward compatibility. ## Validation - **Tests:** - `an_oidc_profile_takes_openshells_oidc_table_and_development_takes_none` covers the dotted and nested tables, the removed fields, and the required and owned table. - `an_existing_oidc_issuer_replaces_the_development_issuer` checks that the table reaches the chart as written and that the provider row holds only `token` and `caConfigMap`. - #13484's connect and operations tests use the new shape. - **Checks:** - `cargo ci` passed, including the bundle and lifecycle steps, after rebasing onto #13484; - `cargo ci live-kind` passed (7 tests), including `kubernetes_live::oidc`, which authenticates with an existing issuer's token through the new table and refuses another audience. After merge, close #13495 by hand.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failure
#12734 asks for unit and fixture coverage of managed-gateway OIDC authentication, token refresh and authentication failures, and of per-agent identity and routing for agents that use cluster-local inference. The Kubernetes gateway code that #13414 and #13063 added had little of either.
OIDC. Every SDK Kubernetes operations and connect test used the development profile, so the
oidcbranches from #13414 had no unit or fixture test: the auth resource identified by its namespace once ready, no issuer objects or signing material, and the token read from the variabletokenEnvnames. The forwarded fake-gateway tests always supplied the token the gateway expected. Only the livekubernetes_live::oidctest refuses a token on the managed Kubernetes path, and it checks neither the error class nor that nothing changed.Several agents on an in-cluster model.
kubernetes_inferencecovered one sandbox, from thelocal.yamlfixture. No test checked per-agent names or routes for the three-agent cluster examples:example_configurations_are_valid_fabric_configurationscompiles them only to validate their Fabric configurations. The #13063 commit message names catalog-skip tests, such askubernetes_inference::cluster_gateways_read_no_model_catalog_for_a_cluster_service, that v1 does not have.Decision
These tests characterize existing behavior; no production code changes.
OIDC
kubernetes_operations: with anoidcspec,ensureof the auth resource adds no cluster objects and no local signing material.readreports no identity before the resource is ready, and the namespace UID after.kubernetes_connect:runningtakes the spec to prepare from. A connection's token equals the value of the variabletokenEnvnames, and no state file contains it. When that variable is unset or empty,connectfails with thetokenEnvmessage.tokenEnvnames variables that Cargo and nextest set for every test process:CARGO_MANIFEST_DIRholds a token, andCARGO_PKG_LICENSE_FILEis empty because the package declares an SPDX license.PATH, the precedent infake_gateway_tests, can't be used: the schema forbids it astokenEnv, so the operations refuse the spec withQuerybeforeconnectreads a token.fake_gateway_tests: theForwardstub's token is now a field, andForward::clientopens a newGatewayClient. A gateway that requires a fresh token refuses every call with a stale one, so nothing changes, and the provider reportsObservationError::Authenticationwithout state. That variant carries no gateway text, so it can't echo the token. A new client with the fresh token then succeeds, as the next command's provider process would; aGatewayClientkeeps its client for the process's lifetime.No test changes a variable's value between commands. That a refreshed token takes effect on the next command follows from these tests and
an_existing_issuers_token_reaches_gateway_only_runs, which resolvestokenEnvinto OpenTofu's environment on each command.Three agents on one in-cluster route
three_agents_on_a_cluster_gateway_share_one_service_registration_with_their_own_rulescompilesexamples/kubernetes/external-gateway.yamlandexamples/openshift/external-gateway.yamlwith the provider endpoint set tohttp://qwen.models.svc.cluster.local:8000/v1. It checks:openshell_inferencewhose server is the Service endpoint with the example provider's credential, and nocluster_source;/v1/**, withoutallowed_ipsorcluster_grants;fabric_agentper sandbox, named by that sandbox'sagent.name, whose models use the Service asbase_url;spec.sandboxesreversed.examples/kubernetes/managed-development.yamlkeeps its hosted endpoint, because its explicit policies name it, and is checked only for agent names. The test reads agent names from each document:mainin the external examples,primaryin managed-development.a_cluster_service_endpoint_reads_no_catalog_while_https_and_private_addresses_keep_theirspins the skip that #13063 landed inendpoint_requests: an endpoint that failsvalidate_endpoint, such as plain HTTP to a Service name, has no catalog request, while an HTTPS endpoint and plain HTTP to10.0.0.5each keep one.The rule lookup and the expected Service rule endpoints move into helpers that the single-sandbox test also uses. Its assertions are unchanged.
Validation
The tests passed when added. If one fails later, the fix belongs in its own PR, with that test as its failing test.
cargo cipassed: tools, fmt, clippy, build, test (1606 passed), schema, bundle, and lifecycle (150 passed), within budget.cargo nextest run -p nemoclaw-sdk -E 'test(/kubernetes_connect|kubernetes_operations|kubernetes_inference|inference_discovery/)'andcargo nextest run -p openshell-provider --libpass.cargo test -p nemoclaw-sdk --test integrationon the three new OIDC tests passes, so both Cargo variables are set undercargo testtoo.ensure; an existing auth directory; a receipt already marked ready;tokenEnvnaming another variable; the token copied into the state directory; a set variable in the missing-token test; a missing client TLS Secret; the stale forward supplying the fresh token; a gateway accepting any token; a new client with a third token.operations.rsidentifying theoidcauth resource by its first issuer object;operations.rsaccepting an empty token;Mutation::failedcarrying state; no credential on a registration that several sandboxes share.cluster_source, a cluster grant orallowed_ipson one sandbox, agents named after their sandboxes (also for managed-development alone), another modelbase_url, agent metadata that depends on sandbox order, no validation skip, rejected private HTTP, and skipped HTTPS.live-kindprofile without the kind-only registry test passed:kubernetes_live::the_gateway_installs_authenticates_and_is_removed_keeping_storage,kubernetes_live::on_openshift_the_sandbox_runs_as_the_namespace_uid,kubernetes_live::oidc::a_managed_gateway_accepts_an_existing_issuers_tokens_and_refuses_another_audience, and the threekubernetes_charttests. The agent was the Pi image from v1 CI'slive-images-linux_arm64artifact ford33d50647, imported into k3s by digest. 6 passed in 82 s.cargo ci live-docker, andcargo ci live-kindon kind includingkubernetes_live::registry, whichcargo ciselects becauseopenshell-providerchanged. Docker isn't installed on this host.🤖 Generated with Claude Code