Skip to content

feat(kubernetes): deploy OpenShell with bundled Helm provider - #12669

Merged
gaveezy merged 8 commits into
feat/kubernetes-profilesfrom
codex/kubernetes-helm-provider
Oct 6, 2026
Merged

gaveezy merged 8 commits into
feat/kubernetes-profilesfrom
codex/kubernetes-helm-provider

Conversation

@gaveezy

@gaveezy gaveezy commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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

flowchart LR
    T["OpenTofu"] --> N["NemoClaw provider"]
    N --> H["Host Helm CLI"]
    H --> K["OpenShell release"]
    N --> A["Storage, issuer, readiness"]
Loading

After

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"]
Loading

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.

@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

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.

# Conflicts:
#	.github/workflows/live-kind.yml
#	crates/nemoclaw-build/src/run_ci/live_kind.rs
Enforce the accepted Ownership and Recovery invariants in
docs/design/scope.md by checkpointing native Helm state before deletion.
Restore only a lost release binding through OpenTofu, retain current
prerequisite state, and require a fresh checked plan on retry.

Exercise actual-provider API outages, permission failures, interrupted
deletion, and cancellation after successful apply. Document the separate
deployment migration policy and test private credential and ownership
boundaries.

Validation: cargo ci (1,184 regular and 101 lifecycle tests), cargo ci
live-kind (five checks on Linux AMD64, Kubernetes 1.37.0 and Agent Sandbox
0.5.0), and Fern checks. Kind cluster and test image cleanup verified.
@gaveezy
gaveezy marked this pull request as ready for review October 6, 2026 14:03
@gaveezy
gaveezy merged commit ad45aea into feat/kubernetes-profiles Oct 6, 2026
8 checks passed
@gaveezy
gaveezy deleted the codex/kubernetes-helm-provider branch October 6, 2026 14:03
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: k8s Affects Kubernetes deployments labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality platform: k8s Affects Kubernetes deployments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants