Skip to content

refactor(config)!: split credential references into SecretRef and FileRef - #13222

Merged
cv merged 5 commits into
v1from
refactor/13080-secret-and-file-refs
Oct 19, 2026
Merged

cv merged 5 commits into
v1from
refactor/13080-secret-and-file-refs

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Splits the configuration's one Credential type into SecretRef, whose environment variable holds a bearer or API credential, and FileRef, whose variable holds the path of a local file.
Existing references keep their {env: NAME} YAML; the managed Kubernetes OIDC token moves from tokenEnv: NAME to token: {env: NAME}. This is shape change 2 of #13080.

Why

One type held both kinds of reference, so the schema, the generated reference, and editors could not say whether a variable must contain a secret or a path (types.rs).

Field Runtime use of the variable's value Type
gateway.credential (external) Bearer token for the gateway connection SecretRef
inferenceProviders[].credential, inline route providers Registered provider credential SecretRef
Web-search integrations.<name>.credential Search provider API key SecretRef
API integrations.<name>.credential (#13403) Key OpenShell injects into requests to the API endpoint SecretRef
gateway.kubernetes.authentication.token (#13414; was tokenEnv) Bearer token NemoClaw sends to a managed gateway with the OIDC profile SecretRef
gateway.tls.ca, certificate, key Read as files FileRef
gateway.kubernetes.kubeconfig Made absolute and passed as the kubeconfig path FileRef
sandboxes[].image.metadata Absolute path of an OCI metadata bundle, read as a file FileRef

Change

  • SecretRef and FileRef replace Credential in the Rust types, the schema, and the reference. There is no alias, so a misclassified reference is a compile error.
  • Both keep the existing env rules: the variable-name pattern and the reserved NEMOCLAW_KUBERNETES_STATE, NEMOCLAW_MANAGED_K8S_, HELM_, and KUBE_ names. The kubeconfig and environment rules are unchanged. A rejected name now reports secret reference … or file reference ….
  • As cv's review asked, there is no file form for secrets and no kubernetesSecret form: reading secrets from files changes the credential model, and OpenShell cannot bind a Secret by reference yet. Adding either later is additive.
  • The OIDC token was the one secret reference held as a bare string (tokenEnv). It is now a SecretRef under token. Its property keeps the kubeconfig reference's reserved names, which tokenEnv also excluded, because the token reaches OpenTofu beside the kubeconfig. A reserved SDK prefix reports secret reference …; a kubeconfig-reserved name reports token environment reference ….

Breaking for Rust SDK callers that name Credential or KubernetesAuthentication::token_env, and for documents using the OIDC profile, which must replace tokenEnv: NAME with token: {env: NAME}. Other authored documents are unchanged.

Retained state is unchanged except for OIDC deployments made since #13414: the openshell_kubernetes_auth resource's oidc attribute is the serialized settings, so state that holds tokenEnv now fails as an invalid managed Kubernetes attribute and is not adopted. Development-profile state stores no settings and is unaffected.

Validation

  • New test config_kubernetes::a_reserved_reference_name_states_whether_the_reference_holds_a_secret_or_a_file_path failed before the change with the shared credential message. It checks each SecretRef and FileRef field, including the API integration key from feat(config): add an integration for key-authenticated HTTP APIs #13403 and the OIDC token, along with the schema location and the message, and that the name is not echoed.
  • config_kubernetes::an_oidc_profile_requires_its_issuer_and_development_takes_no_oidc_settings and the reference-kind test failed on token as an unknown field before the token change. The OIDC test now also rejects tokenEnv and a bare string token.
  • Settings that hold tokenEnv fail to deserialize into KubernetesAuthentication with an unknown-field error, which Spec::from_row maps to the invalid-attribute error. This was checked with a temporary test that is not committed.
  • cargo ci at 64cfa22e5 (linux_arm64; v1 at 1802b0611 merged in): every step passed (tools, fmt, clippy, build, test, schema, bundle, and lifecycle). test: 1,601 tests, 19.2 s wall against a 45 s budget. lifecycle: 150 tests, 106.9 s wall against 300 s. Contract binaries summed 8.4 s of 25 s (fabric-provider), 42.0 s of 45 s (nemoclaw-provider), and 101.6 s of 105 s (openshell-provider). nemoclaw-build docs --check also passed.
  • 5ecebeb63 merges v1 at d33d50647 (fix(build): keep cargo run's OUT_DIR out of CI cargo steps #13460), which changes only build tooling. After the merge, cargo fmt --check, the nemoclaw-build tests, schema --check, and docs --check passed.
  • Not run: the live TLS, kubernetes_live, and kubernetes_oidc suites, which need live clusters and an issuer. They compile under clippy.

Part of #13080.

🤖 Generated with Claude Code

gaveezy and others added 2 commits October 14, 2026 16:19
…eRef

One Credential type held both bearer values and local file paths: the
env value of `tls.*`, `kubeconfig`, and `image.metadata` is a file path,
while the gateway, inference provider, and web-search credentials hold
the secret itself. The schema and reference could not say which.

- SecretRef: external gateway credential, inference provider credential,
  and web-search integration credential.
- FileRef: TLS CA, certificate, and key; managed Kubernetes kubeconfig;
  sandbox image metadata.

Authored YAML stays `{env: NAME}`. Each reference keeps the reserved-name
rules and now reports a message naming its kind. The `file` and
`kubernetesSecret` forms from #13080 are left out: reading secrets from
files changes the credential model, and OpenShell cannot bind a Secret
by reference yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hai Nguyen <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Hai Nguyen <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

This repository limits you to 5 open pull requests. Please close or merge an existing PR before opening another one.

@github-actions github-actions Bot closed this Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability area: security Security controls, permissions, secrets, or hardening refactor PR restructures code without intended behavior change labels Oct 15, 2026
Bring the branch up to date with 108 v1 commits, including the provider
reorganization (#13131), the key-authenticated HTTP API integration
(#13403), and the web search sandbox variable (#13401).

Resolutions:

- config/integrations.rs: keep v1's API integration and web search
  sandboxEnv. The API key, the web search key, and the resolved web
  search key are SecretRef, because each holds the credential itself.
- config/validation.rs: validate the API integration key as a SecretRef;
  the credential() helper it called no longer exists.
- config/schema/validation.rs: keep v1's sandboxEnv rule for webSearch
  variants beside the SecretRef and FileRef env rules.
- kubernetes/mod.rs: keep v1's boxed ManagedKubernetes; its kubeconfig
  is a FileRef.
- nemoclaw-e2e deployment.rs: take v1's removal of the two inference
  credential tests. #13373 folded them into the export_observations.rs
  test, which now builds its reference as a SecretRef.
- config_kubernetes.rs: keep the new tests from both sides, and add the
  API integration key to the reference-kind test as a secret.
- Regenerate the JSON Schema and the configuration reference.

No other v1 field used Credential; the Fabric model provider and driver
configuration changes add none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gaveezy gaveezy reopened this Oct 19, 2026
The OIDC profile from #13414 named the variable holding the managed
gateway's bearer token as a bare `tokenEnv` string, so it was the one
secret reference outside SecretRef. It is now `token: {env: NAME}`.

- SecretRef's `env` rules apply to it. The token property adds the
  kubeconfig reference's reserved names, as tokenEnv did, because the
  token reaches OpenTofu beside the kubeconfig.
- A reserved name now reports `secret reference …` for the SDK prefixes
  and `token environment reference …` for the kubeconfig names.
- The provider's `oidc` attribute is the serialized settings, so it now
  carries `token.env`. Retained state written with `tokenEnv` fails as
  an invalid managed Kubernetes attribute instead of being adopted.
- Update the Kubernetes and credential rotation guides and regenerate
  the schema and configuration reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@gaveezy
gaveezy requested review from cv and sandl99 October 19, 2026 14:20
Bring the branch up to date with v1's fix that keeps cargo run's OUT_DIR out of CI cargo steps (#13460). It changes only build tooling, CI setup, and the testing guide, none of which this branch touches, so the merge has no conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cv
cv merged commit 499cca4 into v1 Oct 19, 2026
@cv
cv deleted the refactor/13080-secret-and-file-refs branch October 19, 2026 18:07
@cv cv added the v1 NemoClaw v1 branch label Oct 19, 2026
cv added a commit that referenced this pull request Oct 19, 2026
…13492)

## Failure

NemoClaw wrote a managed Docker or Podman gateway's `gateway.toml` as
formatted text and spliced `sandboxDriverConfig` into it by searching
for the driver's table header. Every OpenShell setting a user needed
required its own NemoClaw field, type, validation, and docs. On
Kubernetes, the same setting went through the chart's deprecated
`server.drivers.kubernetes` alias. Part of #13473.

## Decision

OpenShell already defines the format. Its Helm chart takes non-secret
gateway configuration through one `gatewayConfig` value: each key names
a TOML table and holds its fields, nested maps are inline tables, and a
list of maps is an array of tables ([migration
guide](https://github.com/NVIDIA/OpenShell/blob/5a7728c304b5528e954e9ae900cf21f84e1a12b1/docs/kubernetes/migrate-gateway-config.mdx)).

- `spec.gateway.config` replaces `sandboxDriverConfig` and uses that
format on every managed runtime.
- **Docker and Podman:** NemoClaw builds `gateway.toml` as TOML values
and merges the authored tables in, instead of formatting text. This
needs `toml`'s `display` feature, which adds `toml_writer` from the same
project.
- **Kubernetes and OpenShift:** the tables go to the chart's
`gatewayConfig`, where they can override NemoClaw's `workspace_mode` and
workspace storage-size defaults. The deprecated alias is no longer used.
- **Validation:** plan rejects a setting that replaces a key NemoClaw
owns, whether written as a dotted table or a nested map. It also rejects
malformed tables, and a table written both ways, as the chart does.
OpenShell validates everything else; it rejects unknown fields in the
selected driver's table and ignores other drivers' tables.
- **External gateways:** take no `config`.

No backward compatibility: the rendered file differs from earlier bytes,
so existing Docker and Podman deployments need a fresh deployment UID,
as before for any change to the file. The follow-up for #13473 writes
the file whenever the gateway container is created, so a configuration
change replaces the container instead.

## Validation

- **New tests** (`managed_gateway_config`, and
`kubernetes_managed_compile::authored_tables_reach_the_chart_gateway_config`
/ `chart_keys_nemoclaw_owns_are_rejected`) failed before the change.
- **What they cover:**
- authored tables, inline tables, and arrays of tables on Docker and
Podman;
  - owned keys rejected in both forms;
  - a table defined twice, and malformed tables;
  - external gateways rejected;
  - the chart merge with overridable defaults.
- **Regenerated:** the JSON Schema, the configuration reference, and the
provider schema fixture.
- **Checks:**
- `cargo ci` passed, including the bundle and lifecycle steps, before
and after rebasing onto #13222.
- `cargo ci live-docker` passed (11 tests) and `cargo ci live-kind`
passed (7 tests) before the rebase; the rebase brought in only #13222's
credential-reference types.
cv added a commit that referenced this pull request Oct 19, 2026
gaveezy added a commit that referenced this pull request Oct 20, 2026
…ices

The base branch merged v1 up to 0bc2601. Resolutions:

- SecretRef/FileRef split (#13222): `credential` on an inference
  provider is now a `SecretRef`. The cluster key keeps its description
  (the same key as the service's `kubernetes.keySecret`), and
  `InferenceTarget::Service` carries `Option<&SecretRef>`. The authored
  form, `credential: {env: …}`, is unchanged, so the examples and
  fixtures stay as they are.
- context_advisory.rs was removed (#13485). This branch had only
  widened its `InferenceTarget::Service` pattern, so the merge takes the
  deletion and drops the call in `Deployment::run`, keeping the
  NetworkPolicy warning before it.
- Runtime images now build with Bake under image/ (#13507), which
  removed nemoclaw-build's runtime_source.rs and tests/runtime_engine.rs.
  The merge takes both deletions. That also removes 05fb557's
  `--offline` packaging and its test: on Live/Docker runners, archived
  tests ran with a Cargo home that lacked the OpenShell git checkout, so
  offline packaging failed ("you are in the offline mode").
- The authoring journey count is 41: v1 removed one single-sandbox
  example and this branch adds two.
- The schema and configuration reference are regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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: architecture Architecture, design debt, major refactors, or maintainability area: security Security controls, permissions, secrets, or hardening refactor PR restructures code without intended behavior change v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants