Repository navigation
feat: deploy to Kubernetes and OpenShift - #12660
Merged
Merged
Conversation
The Fabric wheel stage mounted a shared Cargo target cache at /src/fabric/target. Every Fabric archive extracts to the same path with the same package versions and timestamps, so after a Fabric pin change Cargo could reuse the older compiled core and link the newer Python binding against it. A new regression test reproduces this with a two-crate workspace: on the previous Dockerfile the newer caller fails to compile because the cached core lacks the function it calls. The stage now shares only the uv and Cargo registry download caches. Compiled artifacts stay in the layer built from that source archive, so a different archive rebuilds them. The test reads the stage's cache mounts from the Dockerfile and gives them private ids, so it neither reads nor fills a real cache. It runs in `cargo ci live-docker`. Validation: the regression test fails before the change and passes after it. Co-authored-by: Hai Nguyen <[email protected]>
Kubernetes gateways need the SDK to talk to a cluster. The earlier branch ran kubectl and helm through Python helpers on the user's machine; v1 keeps host code in Rust, so the SDK now connects through the kube crate. connect() reads only the kubeconfig file and context the deployment names. It never falls back to the file's current context, an inherited KUBECONFIG, or in-cluster service variables, so one deployment cannot reach another cluster by accident. The kubeconfig's exec credential plugins still run, which cloud-managed clusters need. kube adds 20 crates (kube, k8s-openapi and their YAML, JSONPath and date dependencies), all under licenses deny.toml allows. Its YAML parser caps smallvec below 1.16, so the lock moves smallvec from 1.16.1 to 1.15.2. The workspace links both rustls providers, so connect() selects ring, as the provider binary already does. Validation: three new tests use the shared HTTP fake. The authored context is used with its exec plugin's token; an unknown context fails; and an inherited KUBECONFIG naming the requested context is ignored. That last test fails when the code reads KUBECONFIG. cargo deny licenses and sources pass, and clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Adds the deployment YAML and planning for sandboxes on a Kubernetes cluster, ported from #12392 onto current v1. - Config: runtime.provider accepts kubernetes and openshift, and gateway.kubernetes names the kubeconfig, context, namespace, prerequisite policy and development authentication. A managed Kubernetes gateway needs an HTTPS 127.0.0.1 endpoint and excludes the local engine settings; OpenShift sandboxes need the OpenShift profile. The schema and configuration reference are regenerated. - Image metadata: Kubernetes has no local engine to inspect, so image.metadata names a local OCI metadata bundle. The SDK verifies its digest chain against image.ref before reading the Fabric catalog and reads no layers. Destroy doesn't need it. - Compile: a managed Kubernetes gateway compiles into kubernetes_storage and kubernetes_gateway resources from one specification, and the gateway's generated credentials reach the OpenShell provider through fixed environment names. OpenShift uses OpenShell's kubernetes driver. - Managed local specs reject Kubernetes targets and drivers, so a cluster target cannot reach the Docker or Podman installers. The provider does not yet act on the two new resource kinds; cluster operations come in the next commits. Compared with #12392, test changes: its test that read the maintained OpenShift examples was dropped, since the shared example test checks every example, and comments calling teardown-only documents "legacy" now describe the destroy behaviour. Validation: 384 focused SDK, provider and build tests pass, including the branch's config, OpenShift, compile and image metadata tests and the schema check. clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
…owns Installing a Kubernetes gateway creates cluster objects that later operations must recognise and must not confuse with someone else's. The earlier branch tracked them in its Python helper; this adds the Rust layer the install commits build on. - Ownership: Cluster::create() labels each object with the deployment's owner and generation and fails if an object already exists at that address, so nothing is adopted. verify() accepts an object only if its UID matches the one recorded at creation and it carries the owner label. delete() sends the recorded UID as a precondition, so a replacement made by someone else is never removed. - Receipt: a private receipt.json in the state directory records the cluster (API server and kube-system UID) and every object created, in order. A later operation against a different cluster, or a receipt written for another deployment, is a binding mismatch. The earlier branch also compared each object's content against a recorded shape; this keeps only the UID and owner checks, which are what decide ownership. Validation: seven new tests, five against the shared HTTP fake playing the API server and two for the receipt. Co-authored-by: Hai Nguyen <[email protected]>
The previous commit (0c1a6cd) only moved kubernetes.rs to kubernetes/mod.rs: a staging error left out its content. This commit adds that content, which the previous message describes. - Ownership: Cluster::create() labels each object with the deployment's owner and generation and fails if an object already exists at that address, so nothing is adopted. verify() accepts an object only if its UID matches the one recorded at creation and it carries the owner label. delete() sends the recorded UID as a precondition, so a replacement made by someone else is never removed. - Receipt: a private receipt.json in the state directory records the cluster (API server and kube-system UID) and every object created, in order. A later operation against a different cluster, or a receipt written for another deployment, is a binding mismatch. - kubernetes::client() builds every client and selects the ring TLS provider once, for connect() and the tests alike. Validation: seven new tests, five against the shared HTTP fake playing the API server and two for the receipt; all 13 Kubernetes SDK tests pass, and clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
A Kubernetes gateway keeps its namespace and credential key across destroy, so a later apply finds the same encrypted credentials. This adds ensure_storage(), which creates them after checking the cluster can host a gateway. - Binds the receipt to the cluster on first use (API server and kube-system UID), so a rebuilt cluster at the same address is refused. - Requires Agent Sandbox (its CRD and an available controller) and exactly one default StorageClass. Installing a pinned Agent Sandbox release when the YAML allows it comes in a later commit; until then it must already be installed. - Creates the namespace and a <name>-kek Secret holding a random 32-byte key, encoded the way OpenShell's credential store reads it. Both are labelled and recorded by UID; an existing namespace is refused, never adopted. - Repeating the call verifies what it created and creates nothing. Tests use a small in-memory Kubernetes API server (tests/support/kube_api.rs) that stores objects by path and supports get, list, create and UID-conditional delete. Validation: five new tests (fresh install and repeat, an existing namespace, missing prerequisites, two default StorageClasses, a rebuilt cluster). The existing-namespace test fails when storage adopts a conflicting object. All 18 Kubernetes SDK tests pass. Co-authored-by: Hai Nguyen <[email protected]>
b774d5d registered the kubernetes_storage and kubernetes_gateway resource kinds with a running attribute, but the provider marked running as computed only for managed_gateway and agent_configuration. The provider schema test caught it in CI on three platforms: the new kinds exposed running as an input. running is now computed for both Kubernetes kinds, as the earlier branch did, and the schema test lists them. Validation: all 141 provider tests and the 1,091 deterministic workspace tests pass locally; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
Adds install() and uninstall() for a Kubernetes gateway's OpenShell release. Helm is the only cluster subprocess the SDK runs. - Chart: OpenShell publishes its chart, so versions.json pins it by digest (oci://ghcr.io/nvidia/openshell/helm-chart@sha256:7a714b..., chart 0.1.2, matching the pinned OpenShell). The earlier branch downloaded the OpenShell source archive to extract the chart. - Values: every image is pinned by digest from versions.json, mutual TLS is on, unauthenticated users are refused, telemetry is off, and the credential key comes from the storage Secret. - Isolation: Helm gets the authored kubeconfig, context and namespace as flags, and an environment cleared of the caller's settings except PATH and the home and temporary directories, which kubeconfig exec plugins need. Its cache, configuration and registry logins live in the deployment's state directory. Output is suppressed, since it can echo values. - install() runs upgrade --install --wait (10 minutes); uninstall() runs uninstall --wait (5 minutes). Storage outlives uninstall. Validation: five tests run a fake helm that records its arguments, environment and values. The environment test fails when the code stops clearing the environment. An ignored test renders the pinned chart with real helm 3.22.0 and these values, and finds the gateway image by digest; it passes locally. All 1,091 deterministic workspace tests pass. Co-authored-by: Hai Nguyen <[email protected]>
Adds the operations the provider will call for kubernetes_storage and kubernetes_gateway, built on the storage and Helm release code. - read() reports each resource's identity and whether it runs. Storage is identified by its namespace's UID and runs once its objects exist; every recorded object is verified on each read. The gateway is identified by the chart's StatefulSet UID and runs when its one replica is ready for the current generation. - ensure() creates storage, or installs the gateway release once storage is ready, and records the StatefulSet UID. - remove() uninstalls the gateway and confirms its StatefulSet is gone. Storage is never removed. - A different identity than the one in state, or a StatefulSet replaced by someone else, is a binding mismatch. - The receipt's state directory is created readable only by its owner. Validation: five tests run against the in-memory API server and a fake helm: nothing exists before apply; storage then gateway both run and read back with the same identities; the gateway waits for storage; a replaced StatefulSet is refused; and remove uninstalls the gateway but keeps storage. All 28 Kubernetes SDK tests and the deterministic workspace suite pass. Co-authored-by: Hai Nguyen <[email protected]>
The provider now acts on kubernetes_storage and kubernetes_gateway, calling the SDK operations from the previous commits. The earlier branch ran its Python helper here. - Backend: each row's encoded specification names the kubeconfig and context; operations keep their receipt in the directory passed through NEMOCLAW_KUBERNETES_STATE and run helm from PATH. A changed specification is refused at plan time rather than updated in place. Storage is never removed and never reads as absent once recorded; the gateway is removed only by destroy. - Provider configuration: platform_only configures the provider without gateway connection settings, so the runtime stage can plan and apply the platform resources before gateway credentials exist. During destroy, retained storage keeps its observed running value instead of being reinstalled. Both changes come from #12392. - Examples: the Kubernetes and OpenShift examples from #12392, which the shared example test now parses, round-trips and schema-checks. - kubernetes::server() returns the API server URL for the authored context, so the provider needs no kube dependency of its own. Validation: five backend unit tests (planned versus recorded identity, incomplete observations, a changed specification, a row of the other kind, removal rules) and #12392's provider planning, refresh and schema tests. All 1,115 deterministic workspace tests pass; clippy is clean across the workspace. Co-authored-by: Hai Nguyen <[email protected]>
Brings in #12663, which moved the compute driver from each sandbox to spec.gateway.runtime.provider. Conflicts and follow-on changes: - compile.rs: the required driver comes from the gateway, mapped to OpenShell's driver so OpenShift still requires kubernetes. - types.rs: ExternalGateway keeps v1's runtime field and this branch's engine description. - Schema rules: the Kubernetes and OpenShift rules now test spec.gateway.runtime.provider. The per-sandbox OpenShift rule is gone, since one runtime now covers every sandbox. The explicit-image rule moved from each sandbox to the document, keyed on the gateway's runtime. - Validation, defaults and discovery read the gateway's runtime. - The Kubernetes and OpenShift examples and tests use the new location; three mixed-driver cases are removed, since a mix can no longer be written down. - The schema and configuration reference are regenerated. Validation: 1,115 deterministic workspace tests pass; schema and docs drift checks pass; clippy is clean.
With the compute driver on the gateway (#12663), a managed OpenShift gateway said OpenShift twice: runtime.provider: openshift and kubernetes.distribution: openshift. A schema rule only kept the two in agreement. The distribution field and its type are gone. A managed cluster target needs gateway.runtime.provider to be kubernetes or openshift, and openshift selects the OpenShift profile. The provider still maps it to OpenShell's kubernetes driver. The compiled Kubernetes resource specification still carries the runtime through its gateway settings, so the platform identity still distinguishes the two profiles. Validation: the OpenShift tests now check that the runtime alone selects OpenShift, that a distribution field is rejected, and that a managed cluster target refuses docker and podman; they failed before the change. The test of distribution's default is removed. All 1,114 deterministic workspace tests pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
OpenShell authenticates users with OIDC tokens. For a development gateway the SDK is its own issuer. #12392 did this with openssl and an RSA key; this uses Rust libraries already in the workspace. - Material: an ECDSA P-256 CA and an issuer certificate for <name>-oidc.<namespace>.svc.cluster.local, and an Ed25519 signing key, kept in <state>/auth/ readable only by the owner. They are created once and reused; a partial set, as after an interrupted write, is refused rather than replaced. The signing key is written last, so its presence marks a complete set. - Documents: the OIDC discovery document and a one-key set (OKP, Ed25519, EdDSA). OpenShell v0.1.2 accepts Ed25519 keys. - Tokens: one-hour EdDSA tokens with the deployment's UID as audience, the development admin role, and every OpenShell scope. rcgen (already used by the e2e tests) and ring (already linked through rustls) are now SDK dependencies. The issuer runs in the cluster in the next commit. Validation: five tests check that material is created once, kept private and reused; that a partial set is refused; that the discovery document and key set name the issuer; that a token verifies with the published key and carries the deployment's claims; and that rustls trusts the issuer certificate for the issuer host only. All deterministic workspace tests pass; cargo deny licenses and sources pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
The gateway verifies development tokens against a key set it fetches over HTTPS. #12392 ran a Python server in the cluster for this; here a pinned static server publishes two files and nothing else. - Issuer: nginxinc/nginx-unprivileged@sha256:5aea7c... (1.29.3, multi-arch), pinned in versions.json. It runs non-root with a read-only root filesystem, no capabilities, no service account token, and the image's entrypoint scripts skipped. It serves the discovery document and key set from a ConfigMap and returns 404 for anything else. The private signing key stays on the operator's machine. - Network: a NetworkPolicy admits only the gateway's pods on 8443 and allows no egress. - Lifecycle: the issuer's six objects belong to the gateway. Ensure creates or verifies them before installing the release; remove deletes them after the release is gone. They are recorded by UID in the receipt, like every other owned object. - Gateway: the chart's server.oidc values name the issuer, use the deployment's UID as audience, map the development roles and scopes, and mount the issuer CA through caConfigMapName. Validation: the operation tests check the issuer objects exist after ensure, the published key set has no private part, the policy has no egress, and remove deletes the issuer but keeps storage. A new live-docker test runs the pinned image read-only with the generated configuration and fetches both documents over HTTPS with the issuer CA; it passes locally. Real helm 3.22.0 renders the chart with these values and mounts the CA through SSL_CERT_FILE. All deterministic workspace tests pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
…orward The gateway isn't exposed outside the cluster, so each command needs a temporary connection to it. #12392 ran kubectl port-forward under a Python supervisor; this forwards through the Kubernetes API in the SDK process. - Operations::connect() requires the gateway to be running, then listens on the authored loopback port and forwards each connection to the gateway pod's gRPC port through kube's port-forward stream. An occupied port is refused, so a different process can't stand in for the gateway. Dropping the connection stops the forward. - Credentials: the client CA, certificate and key from the chart's <name>-client-tls Secret are written to <state>/client/, readable only by the owner, and a fresh development token is signed. The connection exposes them as the four NEMOCLAW_MANAGED_K8S_* values the provider's credential references name. - The gateway's own certificate includes 127.0.0.1, so TLS to the forwarded port verifies without host overrides. Validation: four tests. The forwarder carries bytes both ways for successive connections to a local echo server; a connection writes private client files under the state directory and supplies a token for the deployment; an occupied port is refused; and a gateway that isn't ready can't be connected. The port forward to a real pod is exercised by the kind lifecycle later in this series. All deterministic workspace tests pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
…ration Plan, apply, export and destroy now open the managed Kubernetes gateway's connection before talking to it, and close it afterwards. The deployment changes come from #12392; kubernetes::connection() now builds on the Rust operations instead of the Python helper. - Deployment::connected() opens the connection for a document whose gateway is a managed Kubernetes target. The connection's four credential values are passed only to that operation's provider processes, and the guard keeps the port forward open until the operation ends. - Every provider process gets NEMOCLAW_KUBERNETES_STATE, the deployment's kubernetes state directory. - Provider processes never inherit NEMOCLAW_MANAGED_K8S_* or NEMOCLAW_KUBERNETES_STATE from the caller's environment; only the operation sets them. - The runtime stage refuses a gateway without its storage binding, and reports the gateway running only when it already was. Destroy keeps storage and skips agent teardown when the platform never came up. - connection() resolves the kubeconfig through the deployment's secrets and honours cancellation while connecting. Validation: #12392's deployment, runtime and teardown tests, updated for spec.gateway.runtime.provider. All 1,132 deterministic workspace tests pass; clippy is clean. A real gateway is exercised by the kind lifecycle later in this series. Co-authored-by: Hai Nguyen <[email protected]>
Everything in this series so far ran against an in-memory API server, a fake helm and a local echo server. This adds a live test on a real cluster, before building more on those assumptions. - cargo ci live-kind downloads the pinned kind (v0.33.0) and helm (3.22.0) by checksum into .tools, creates a kind cluster from the pinned node image (Kubernetes 1.37.0), and installs the pinned Agent Sandbox release in it, as a platform would. It deletes the cluster whether or not the tests pass. Plain cargo ci never selects it. - The test installs storage, the development issuer and the gateway release with the real chart; opens the in-process port forward; and calls GetGatewayInfo, which needs the bearer token, the config:read scope, the platform admin role and mutual TLS. A token signed by another key is refused. It then removes the gateway, checks storage remains, and installs the gateway again on the kept storage. - Live / Kind runs it on v1 pushes, run-live-kind/ branches and manual runs, on Linux ARM64 and AMD64, like Live / Docker. Validation: cargo ci live-kind passes locally on Linux ARM64 in 94 seconds; the test itself takes 29. With the token signature broken on purpose, the real gateway refuses it with an authentication error and the test fails; the cluster was deleted after both runs. This is the first evidence that OpenShell v0.1.2 accepts the Ed25519 tokens, the chart's certificate job and the port forward work, and the issuer is reachable through its NetworkPolicy. All deterministic workspace tests pass; clippy is clean with and without the sdk feature. Co-authored-by: Hai Nguyen <[email protected]>
Contributor
|
@cv following your suggestion to avoid a dependency on the Helm CLI, I’ll try using OpenTofu’s |
1f2bd9b added walk(), used only by the Unix part of the issuer image test. On Windows it was unused, and the CI / Native clippy step failed on 684e92e with "function `walk` is never used". walk() is now Unix-only, like its caller. Validation: clippy is clean on Linux. Co-authored-by: Hai Nguyen <[email protected]>
…nstall it gateway.kubernetes.prerequisites.agentSandbox.management chose between requiring Agent Sandbox and installing a pinned release. Installing it was never implemented, and doing so would make a deployment own cluster-wide CRDs and a controller that other tenants share. The kind lifecycle installs Agent Sandbox as cluster setup, as a platform would, and that works. The setting is gone. A managed Kubernetes deployment requires Agent Sandbox's CRD and an available controller, and one default StorageClass, before it creates anything; it installs nothing cluster-wide. A document that still sets prerequisites is rejected. - Config: KubernetesPrerequisites, AgentSandboxPrerequisite and KubernetesPrerequisiteManagement are removed; the schema and configuration reference are regenerated. - Storage checks Agent Sandbox on every ensure instead of recording how it was found; the receipt loses its prerequisites field. - The Kubernetes and OpenShift examples drop the setting and say what the cluster must already have. Net change: +33 / -170 lines. Validation: a new test rejects a document that sets prerequisites; it failed before the change. The storage test that requires Agent Sandbox still passes. All 1,133 deterministic workspace tests pass; schema and docs drift checks pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
image.metadata was optional for Kubernetes and OpenShift sandboxes so that documents written before the field existed could still be torn down, with a test describing that as "legacy intent". v1 is unreleased, so no such documents exist. - The schema now requires image.metadata, with image.ref, for every sandbox on a kubernetes or openshift gateway; a sandbox without it is rejected when the YAML is parsed rather than at discovery. - Discovery no longer substitutes an empty metadata reference. - Destroy still drops the metadata reference before running, because it never reads the image and shouldn't ask for its bundle. - The legacy teardown test is removed, and the engine-spec test is renamed to say what it checks. Validation: a new test rejects a cluster sandbox without image.metadata; it failed before the change. All 1,133 deterministic workspace tests pass; schema and docs drift checks pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
Collaborator
Author
|
@gaveezy great idea! Please feel free to add commits directly to this PR. |
#12663 moved the compute driver from each sandbox to spec.gateway.runtime.provider but missed the document that cargo ci live-docker writes for its gateway tests. Live / Docker on v1 has failed since ef51a9c: the gateway recovery test rejected the document with "unknown fields are not allowed" at spec.sandboxes[0]. The template now sets the runtime on the gateway. A new test parses the generated document with the SDK; the existing test checked individual fields, which is why the stale shape went unnoticed. It failed before the change. Validation: cargo ci live-docker passes on Linux ARM64, all eight tests including the three gateway tests that failed on v1.
OpenShell's Kubernetes driver runs every sandbox as 10001:10001 unless told otherwise, while our agent images ran as 1000:1000. #12392 built separate openclaw-kubernetes and openclaw-openshift images that re-owned the image for 10001. Docker and Podman instead run the image's own user, so moving the images to 10001 lets one image serve all three. - image/fabric/Dockerfile: the node user and /sandbox are 10001:10001 in the agent base and the dummy reference image. - image/fabric/runtime.json: the default process policy runs as 10001:10001. - The command contract runner's /sandbox tmpfs, the v1 hosted parity documents, the examples with an explicit process policy, and the tests that name the user all use 10001. The recorded v0 exports keep 1000; the parity test's projection maps v0's user to v1's. No separate Kubernetes images are added. OpenShift assigns a UID per namespace and is handled with the OpenShift profile. Existing local Docker volumes written by a 1000:1000 image would keep that owner; v1 is unreleased, so there is no migration. Validation: the image test now asserts 10001 and failed on the previous Pi image. The image check stages (lint, unit and reference tests) pass; a rebuilt Pi image passes the image test, the command contract and Pi's native check; cargo ci live-docker passes all ten tests, including the gateway tests that run real sandboxes. All deterministic workspace tests pass; clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
A Kubernetes or OpenShift sandbox must name a metadata bundle in image.metadata, since no local engine can be inspected there. The SDK could read one, but nothing wrote it; #12392 used a 263-line Python script. cargo images export-metadata IMAGE --platform P --output PATH saves the image from the local Docker engine and writes the bundle to a new file. The bundle holds the image's index, the manifest for the platform and that manifest's configuration, each as its exact bytes, and nothing else: no layers or attestation manifests. Every blob is checked against its digest while it is read. docs/build.md describes when and how to run it. Validation: three tests build an OCI archive shaped like docker image save's output (an outer index, the image index, one manifest and an attestation): the bundle holds only index, manifest and config with their exact bytes; a missing platform is refused; and the SDK verifies an exported bundle for the image's digest. Exported from the real UID 10001 Pi image, the bundle is 20 KB and the SDK accepts it for the image's digest and refuses another digest. All deterministic workspace tests pass; clippy is clean with and without the sdk feature. Co-authored-by: Hai Nguyen <[email protected]>
On Kubernetes, OpenShell seeds a sandbox's workspace volume by copying the image's /sandbox, then starts its supervisor with the image's TMPDIR, /sandbox/tmp. The supervisor's Landlock probe creates a directory there before Fabric runs, and Fabric is what made tmp, so the sandbox exited with "create Landlock probe root: No such file or directory". Docker and Podman did not notice because Fabric's mkdir ran first there. Both agent image stages now create /sandbox/tmp, owned by 10001, next to /sandbox. Validation: a new image test reads TMPDIR from runtime.json and checks that it is a directory under /sandbox owned by 10001. It failed on the previous Pi image and passes on the rebuilt one. On kind the rebuilt image's sandbox gets past the probe and runs its agent. Co-authored-by: Hai Nguyen <[email protected]>
The kind test covered only the gateway. This adds a full deployment through the public SDK, as a user would apply it: the managed gateway, then a sandbox from an agent image built from this checkout. cargo ci live-kind now builds that image (Pi on ARM64, OpenClaw on AMD64), exports its metadata bundle, loads it into the cluster and passes it to the tests with the native bundle. Two details were needed: - kind loads an image by tag only, so the runner also names it by its digest on the node; otherwise a sandbox that references the digest tries to pull it from a registry. - the SDK runs helm from PATH, so the pinned Helm goes ahead of the PATH that already holds the pinned nextest. The image is removed afterwards, and NEMOCLAW_KEEP_KIND_CLUSTER keeps a failed run's cluster for inspection. The new test expects apply to fail only at data.nemoclaw_sandbox_readiness.assistant, since the pinned Fabric reports health as unsupported (#12443), and destroy never to touch the gateway's storage. Its route carries model metadata, which Pi and OpenClaw require for a model they do not know. Validation: cargo ci live-kind passes on Linux ARM64 (2 tests). The sandbox, gateway, issuer and supervisor all ran; after destroy only the gateway's four Secrets and its data volume remained. All deterministic workspace tests pass; clippy is clean with and without the sdk feature. Co-authored-by: Hai Nguyen <[email protected]>
…tore cargo ci live-kind now deploys an agent sandbox, so it needs the native bundle and an agent image exported as an OCI index, which Docker writes only with its containerd image store. The workflow builds the tests and the bundle and switches the image store, as Live / Docker does. Validation: run on this branch through run-live-kind/ on both Linux platforms. Co-authored-by: Hai Nguyen <[email protected]>
Since agents run as UID 10001 (e9f2810), the OpenClaw image no longer built: upstream's /app belongs to its own user, UID 1000, so moving the Brave and Tavily plugins into /app/dist/extensions as the agent user failed with "Permission denied". CI / Images has failed on this branch since that commit, and the kind job failed on AMD64, where it builds OpenClaw. /app is now copied owned by root, and the plugins are moved into it as root and made world-readable, like the plugins OpenClaw bundles. The installer still runs as the agent user, and the stage ends as it. Validation: a new check in the image test asserts that /app belongs to root and that the agent cannot write its extensions directory. On the rebuilt ARM64 OpenClaw image, the image test, the command contract, the reconfiguration test and the native OpenClaw check (two invocations, two inference requests) all pass. Co-authored-by: Hai Nguyen <[email protected]>
On OpenShift, OpenShell runs a sandbox and its workspace setup as the UID the namespace assigns, not 10001. Setup copies the image's /sandbox to the workspace volume, but /sandbox was 0700 and owned by 10001, so another UID could not read it: running the Pi image as 1000680000 gave "Permission denied". /sandbox and /sandbox/tmp are now 0755, still owned by 10001. The copy on the workspace volume stays private, since OpenShell creates each directory it copies as 0700. One image keeps serving every runtime, rather than adding an OpenShift image per harness as #12392 did; the images are to move to the Fabric project. On Docker and Podman the sandbox uses /sandbox directly, so other users in the container can now list it; a sandbox runs only the agent and root. Validation: a new image test walks /sandbox and requires every entry to be readable, and directories searchable, by another UID. It failed on the previous Pi image and passes on the rebuilt one. Run as UID 1000680000, the rebuilt image can list /sandbox but not write to it. Co-authored-by: Hai Nguyen <[email protected]>
The pinned OpenShell chart runs the gateway as runAsUser 1000 with fsGroup 1000. OpenShift's default security policy admits only UIDs from the range it assigns each namespace, so it would reject the gateway pod. With runtime provider openshift, the SDK's chart values set both to null, which removes them; runAsNonRoot and the dropped capabilities stay. Kubernetes keeps the chart's values. The two tests that render the pinned chart with a real Helm now also run in cargo ci live-kind, which already provides one; before, no workflow ran them. Validation: a new render test with provider openshift finds no runAsUser or fsGroup and keeps runAsNonRoot. It fails with the change disabled. The Kubernetes render still has runAsUser 1000. All deterministic workspace tests pass. Co-authored-by: Hai Nguyen <[email protected]>
bd212a3 removed the chart's fixed runAsUser and fsGroup on OpenShift, expecting OpenShift to fill them in. On a cluster that does not, the gateway ran as its image's user, 1000, while its signing key Secret, mounted 0400, belonged to root without an fsGroup, so the gateway could not read it and crashed in a loop. Relying on admission to fill both in also left the gateway's identity outside our tests. On OpenShift the SDK now reads the namespace's openshift.io/sa.scc.uid-range and supplemental-groups annotations after creating it, and runs the gateway with runAsUser and fsGroup set to the first UID and group, the same choice OpenShell makes for sandboxes. OpenShift writes the annotations shortly after creating a namespace, so the SDK waits up to 30 seconds; if they never appear, apply stops before Helm runs with "OpenShift did not assign the namespace a UID range" and keeps the resources. A missing group range falls back to the UID, as OpenShell does. Validation: tests cover parsing the ranges (including zero, overflow and malformed values), the chart values the gateway is installed with, and a cluster without ranges, where Helm never runs. The two operations tests fail with the lookup disabled. The real Helm render has runAsUser 1000680000 and fsGroup 1000690000. All deterministic workspace tests pass. Co-authored-by: Hai Nguyen <[email protected]>
kind cannot enforce OpenShift's security policy, but the SDK and OpenShell both choose their pods' identities from the UID range OpenShift writes on a namespace, and that works on any cluster. The new test deploys with runtime provider openshift and writes the range itself once the SDK creates the namespace, as OpenShift would. It then checks that the gateway and the sandbox both ran as the range's first UID, that apply stopped only at the agent's health check (#12443), and that destroy kept storage. The sandbox part also covers OpenShell copying the workspace seed as a UID other than 10001. It shares its deployment with the Kubernetes sandbox test, which now differs only in its runtime provider. What kind cannot show is OpenShift admitting these pods; that needs a real OpenShift cluster. Validation: cargo ci live-kind passes all five tests on Linux ARM64. Co-authored-by: Hai Nguyen <[email protected]>
The cluster examples named openclaw-kubernetes and openclaw-openshift images, build targets from #12392 that this branch does not have: the same agent image now serves every runtime. They now name the regular openclaw image and say how to write its metadata bundle with cargo images export-metadata. The OpenShift example no longer says its profile is only tested offline, since cargo ci live-kind now runs it; a real OpenShift cluster has still not admitted these pods. Validation: the example tests (56) and all deterministic workspace tests pass. Co-authored-by: Hai Nguyen <[email protected]>
…without OpenShift ranges Test / darwin_arm64 failed on d7f14b5's test for a cluster without OpenShift UID ranges: the storage step before it returned Transport. The test paused Tokio's clock so its 30-second wait would pass instantly, but a paused clock also advances through the HTTP client's timeouts whenever the runtime is idle, so a request to the fake API server could time out before it was answered. Linux happened to win that race. The wait is now a field on Operations, OPENSHIFT_WAIT (30 seconds) in production, and the test sets 50 milliseconds on a real clock. Validation: the test passed 30 times in a row locally; all deterministic workspace tests pass and clippy is clean. Co-authored-by: Hai Nguyen <[email protected]>
Managed Kubernetes deployments currently require a host-installed Helm
CLI. This change lets OpenTofu manage the OpenShell release through the
bundled `hashicorp/helm` provider, pinned to 3.3.0.
### Before
```mermaid
flowchart LR
T["OpenTofu"] --> N["NemoClaw provider"]
N --> H["Host Helm CLI"]
H --> K["OpenShell release"]
N --> A["Storage, issuer, readiness"]
```
### After
```mermaid
flowchart LR
T["OpenTofu"] --> R["helm_release.gateway"]
R --> H["Bundled Helm provider 3.3.0"]
H --> K["OpenShell release"]
T --> N["NemoClaw provider"]
N --> A["Storage, issuer, readiness"]
```
The runtime graph orders retained storage, development authentication,
`helm_release.gateway`, and gateway readiness. Teardown reverses that
order and retains the namespace, encryption key, and PVCs. NemoClaw
manages preparation and readiness; only the Helm provider installs,
upgrades, and removes the chart release. The release cannot create/adopt
the namespace or take ownership of existing resources. Issuer private
material stays outside Helm values and OpenTofu state.
On OpenShift, authentication preparation waits for UID/group ranges on
the owned namespace and supplies numeric chart overrides through a
computed OpenTofu value. The private receipt retains that identity:
normal refresh rejects changed ranges, while cleanup uses the recorded
identity if annotations disappear.
The bundle includes checksum-pinned provider archives and the unchanged
upstream license for five platforms. The provider receives the authored
kubeconfig and context; ambient Helm/Kubernetes controls and conflicting
credential references are rejected. Release identity checks cover name,
namespace, and chart, with an independent release-record observation
before teardown accepts absence.
### Recovery and migration
The pinned upstream provider can discard a release binding when a lookup
fails during deletion, after planning has succeeded. SDK teardown now
saves a private checkpoint before removal. If a failed or interrupted
operation loses that binding, SDK recovery validates the original
bundle, intent, generations, state lineage/serial, provider
configuration, and retained resource identities. It then uses native
OpenTofu state operations to restore only `helm_release.gateway`,
preserving the latest state of other resources. A retry obtains a fresh
validated plan before further deletion. Successful authentication
cleanup confirms release absence and prevents restoration after
completed removal.
Recovery makes no Kubernetes mutation or automatic deletion retry.
Cancellation keeps destroy resumable, including cancellation immediately
after successful native apply. Preview refuses when binding restoration
is needed. Operators repair API access and rerun the normal destroy
command with the same bundle and complete state directory; manual import
or whole-state rollback is unnecessary. The upstream provider binary
remains unchanged. See `docs/usage.md` and `docs/state.md` for the
recovery contract.
`docs/migration.md` defines a separate-deployment transition from the
old combined gateway resource: retain the original
bundle/configuration/state for recovery and retirement, and evaluate
this graph with a fresh deployment UID, state directory, and unused
namespace. There is no in-place state conversion or adoption of old
retained storage. Native-data transfer remains outside this procedure.
Local kind testing also exposed an existing issuer failure on hosts with
many CPUs: Nginx's automatic worker count exceeded its 64 MiB limit. The
issuer uses one worker, with a sustained HTTPS regression for that
budget.
### Validation
Validated commit `61d6d8984`, including target branch
`feat/kubernetes-profiles` through `5bb8651c2`.
- Full `cargo ci` passed: formatting, Clippy, build, 1,184 regular
tests, doctests, schema checks, verified bundle assembly, and all 101
lifecycle tests.
- Five recovery lifecycle tests use the actual bundled OpenTofu, Helm
provider, and SDK destroy against a loopback Kubernetes API. They cover
outages and HTTP 403 before and after planning, interruption,
cancellation after successful apply, and healthy retries. The
lost-binding and late-cancellation regressions were observed failing
before their fixes. These tests run in normal `cargo ci`.
- Nine checkpoint validation tests cover changed intent, bundle,
generations, state lineage/serial, provider identity,
unexpected/replaced bindings, and stale checkpoints after completed
destroy or reapply.
- `cargo ci live-kind` passed all five checks (three live tests and two
chart renders) on Linux AMD64, pinned Kubernetes 1.37.0, and Agent
Sandbox 0.5.0. It built and loaded the OpenClaw image in a fresh
cluster. Cluster deletion and removal of the test image tag were
independently verified.
- The gateway test runs OpenTofu and its providers with an empty `PATH`:
initial plan without mutation, install, unchanged plan, authenticated
access, forged-token rejection, removal, reinstallation, and retained
namespace/key/PVC identities.
- Ownership regressions check exact public credential-reference values,
numeric-only OpenShift overrides, dependency ordering, and actual
rendered manifests. Helm does not also render NemoClaw's namespace,
encryption key, or issuer objects.
- Fern documentation checks passed with zero errors. The authenticated
redirect check was skipped because no Fern login is configured.
The kind OpenShift-profile test supplies namespace range annotations and
checks pod UIDs; kind does not enforce OpenShift security context
constraints. This does not qualify actual OpenShift admission. SDK agent
tests reach the expected unsupported Fabric health boundary and then
destroy successfully; they do not establish healthy-agent behavior or
inference.
Preserve Helm provider inputs during export and resolve caller-relative kubeconfig paths before provider processes change working directories. Reject missing or mismatched bound issuer material without regenerating it, while retaining credential-independent cleanup after release removal. Own active forwarding streams and pending dials for the connection lifetime. Validate manifest config platforms for direct and indexed image metadata. Follow the ownership and recovery contract in docs/design/scope.md. Add regressions and extend both managed kind profiles to export after the known unsupported health result with a caller-relative kubeconfig. Validation: full cargo ci (1193 workspace and 102 lifecycle tests), all five fresh kind checks, and documentation checks (authenticated redirect check skipped without Fern login). Test cluster and image tag removed.
Test / windows_amd64 failed on a3af55d: since that commit the SDK makes the kubeconfig path absolute, and on Windows "/private/kubeconfig" becomes "D:\private\kubeconfig", while the test still expected the text it was given. The test now compares against std::path::absolute of the same path, which is unchanged on Unix. Validation: the test passes locally; all deterministic workspace tests pass. Windows is checked by CI.
No user guide covered the Kubernetes and OpenShift runtimes: the configuration reference described the fields, and the ownership, Helm-removal recovery and migration sections explained internals, but nothing walked a reader through a deployment. docs/kubernetes.md covers the prerequisites, preparing an agent image and its metadata bundle, a managed development gateway, what changes on OpenShift, using an existing gateway, and destroy with what it keeps. It links the existing sections for ownership, Helm-removal recovery, retention and migration instead of repeating them, and says plainly that apply stops at the agent's health check (#12443). It is listed in the documentation index and published as "kubernetes". The limits page gains three rows: OpenShift admitting the pods (kind does not enforce its security constraints) and managed model services on a cluster, both added to #12641, and identity providers for the managed gateway, filed as #12692. Validation: fern check reports no errors and every link in the changed pages resolves; the docs and example tests pass. Both cluster examples plan with the built bundle. The commands and options the guide uses match nemoclaw and cargo images help. The guide has not had an independent review.
Brings in #12579 (onboarding reads the target with the plan's own queries). Four files conflicted: - Cargo.lock: taken from v1 and regenerated from both manifests; no package the branch used is lost. - config/constraints.rs: v1's public GATEWAY_ENGINE plus the branch's KUBERNETES_GATEWAY_ENDPOINT. - deployment/plan.rs: the branch's Helm test module, then v1's discovery_tests, which v1 made pub(super). - discovery_graph.rs: v1's query-driven graph. The branch's Kubernetes rules moved into plan_queries: a cluster has no engine to read (engine "", no hardware or platform read for managed Kubernetes), and each image query carries its sandbox's metadata_env. The graph passes metadata_env to the image read and keeps the metadata-bundle error message for cluster sandboxes. Two follow-ups the merge needed: - nemoclaw-discovery (new in v1) reads a cluster image from its metadata bundle when the query names one, as the provider does. - The SDK no longer depends on reqwest in v1; the branch's auth test still does, so it is a dev-dependency. v1's new onboarding test expecting the Docker socket as the default engine suggestion failed after the merge: the branch had moved the managed gateway's endpoint, engine and image defaults into the schema's non-Kubernetes branch, where onboarding does not look. The defaults are now stated on each field's own schema as well; a default does not validate, so the Kubernetes branch still excludes those fields. A new schema test failed before this and passes now; the reference shows the defaults again. Validation: clippy clean; all 1229 deterministic workspace tests pass; the rebuilt bundle plans both cluster examples (4 resources each); the export test that fails on Windows passes on Linux.
OpenTofu and its providers received almost the whole caller environment, excluding only a few prefixes such as TF_ and HELM_. So every unrelated credential in a user's shell reached the providers. The SDK also treated any inherited variable whose name contains KEY, TOKEN, SECRET or PASSWORD as a secret to redact, and one shorter than 8 characters withheld every OpenTofu diagnostic. That is why runtime_export_declares_the_native_helm_provider_inputs fails on the Windows runner, and why a user with, say, SOME_API_KEY=abc gets no error details. Children now inherit only platform variables: PATH, home and temporary directories, locale, Windows system settings, proxies, trusted certificates and SSH_AUTH_SOCK. Names are compared without case, as Windows does, and the runtime controls that were excluded before stay excluded. What a deployment's providers need is passed explicitly, as resolved credential references already are. Only those passed values are redacted; a short one still withholds diagnostics, since redacting it would reveal it. The SSH-placement tests passed their fake ssh's state directory through the environment; the fake is now installed as a wrapper that sets it. Validation: three new tests cover the inherited set, Windows-style names, and that only passed values are secrets; two of them fail on the previous code. All 1232 deterministic tests, all 101 lifecycle tests and all Docker live tests pass on Linux ARM64. Windows is checked by CI.
Since 3cd1095, OpenTofu and its providers inherit only platform variables. The NemoClaw and Helm providers connect to the cluster from inside OpenTofu, so a kubeconfig whose exec plugin needs the caller's cloud credentials, such as aws for EKS or gke-gcloud-auth-plugin for GKE, would no longer get them. gateway.kubernetes.environment lists those variables, for example [AWS_PROFILE, AWS_REGION]. They are resolved and passed like credential references, so an unset one fails before any cluster operation and their values are redacted from diagnostics. Each name must be a unique variable name that does not shadow the process, trust, proxy or cluster controls the kubeconfig reference already reserves, plus the Kubernetes runtime controls. At most 32 names. The guide, the ownership design and the reference describe the field. Validation: new tests cover parsing and round trips, rejected names (PATH, KUBECONFIG, HTTPS_PROXY, TF_, HELM_, LD_ prefixes, lowercase, repeats), and that listed values reach the provider environment while an unset one fails; that test fails without the change. All 1235 deterministic tests and all five kind tests pass on Linux ARM64; fern check and the schema check pass.
cv
marked this pull request as ready for review
October 6, 2026 21:55
cv
enabled auto-merge (squash)
October 6, 2026 22:06
cv
added a commit
to Adr1an04/NemoClaw
that referenced
this pull request
Oct 7, 2026
v1 added a managed Kubernetes deployment's gateway and storage resource kinds to the generations Record::new allocates (NVIDIA#12660). This branch moved that allocation into required_generation_kinds and allocate_missing_generation_values, so the two kinds are now listed there, and supported_generation_kind accepts them so a saved Kubernetes record still validates. a_kubernetes_records_generations_reload_and_stay_stable checks both kinds are allocated and survive a save, reload and reallocation; it fails without them. Validation: clippy clean; all 1238 deterministic workspace tests pass.
cv
added a commit
that referenced
this pull request
Oct 7, 2026
v1 (#12660) moved the managed gateway's local settings into a schema branch that applies without a Kubernetes target, and restated their defaults on each field so onboarding can read them. Both conflicts are resolved by keeping v1's structure and adding this branch's rule beside it: a Podman runtime requires spec.gateway.engine. The engine field keeps Docker's socket as its schema default, which a Docker runtime still gets; its description now says Podman requires its own socket. Onboarding (#12579, also new on v1) reported "No podman engine answered on this machine" only on a target assessment, which it builds from a complete document. With Podman now requiring an engine, the document is incomplete, so the message was lost. The journey now adds an unverified assessment carrying that reason when none exists. The document still cannot be saved until an engine is given, and the engine question still offers no Docker socket for Podman. Validation: clippy clean; schema check passes; all 1236 deterministic workspace tests pass, including both v1 onboarding tests that failed after the first resolution and this branch's Podman schema test.
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.
Summary
NemoClaw can now run agent sandboxes on an existing Kubernetes or OpenShift cluster, through a gateway NemoClaw installs or one the operator already runs. This replaces #12392: the plan and its reasoning are on that PR, and Hai Nguyen's work there is credited with
Co-authored-bytrailers.Apply stops at the agent health check on every runtime, because the pinned Fabric reports health as unsupported (#12443). On a cluster it stops there after the gateway and every sandbox are running.
What users get
gateway.management: managedandgateway.kubernetesgateway.management: externalgateway.runtime.providerchooseskubernetesoropenshift.See the guide and the examples in
examples/kubernetes/andexamples/openshift/.Things to know:
kubectl, Python oropenssl.image.metadata;cargo images export-metadatawrites it.AWS_PROFILEfor EKS, list them ingateway.kubernetes.environment. They are passed like credential references; nothing else from the caller's environment reaches the cluster operations.How it fits together
flowchart LR S["CLI or SDK"] --> T["OpenTofu"] T --> N["NemoClaw provider:<br/>namespace, key, issuer, readiness"] T --> H["Bundled Helm provider"] H --> G["OpenShell gateway release"] S -- "port forward per command" --> G G --> X["Sandboxes, via Agent Sandbox"]Managed Kubernetes ownership lists who owns each resource. The issuer's private key stays out of Helm values and OpenTofu state.
The pinned Helm provider can forget a release when a lookup fails during removal. Destroy saves a private checkpoint first, so a retried destroy restores only that binding and continues from a fresh, checked plan (recovery).
Changes outside Kubernetes
These affect every runtime:
/sandbox/tmp, and keep/sandboxreadable by other UIDs. Existing images need rebuilding. Nothing migrates data that a UID 1000 agent wrote to a retained volume, and no doc mentions it yet./appas root, so the agent can read its plugins but not change them.PATH, home and temporary directories, Windows system settings, proxies, trusted certificates,SSH_AUTH_SOCK). Before, they got nearly the whole caller environment, and any inherited variable named like a credential and shorter than 8 characters hid every OpenTofu error. Now only values the SDK passes on purpose are redacted.Tests
cargo ci live-kindruns on a temporary kind cluster (Kubernetes 1.37, Agent Sandbox 0.5.0, Linux ARM64 and AMD64):The deterministic suite covers ownership, recovery checkpoints, the gateway values, the OpenShift identity, the port forward and the metadata bundle. In the lifecycle step, five recovery tests run the bundled OpenTofu and Helm provider against a local fake Kubernetes API.
Not covered
spec.servicesis rejected with a cluster gateway (Qualify more platforms, placements, models, and integrations #12641).Status
This merges
v1at606ea2970c(#12579). That merge needed one schema fix, described in its commit.All checks pass on
6397fd8d89, includingTest / windows_amd64, which failed before the OpenTofu environment change.