opencode

by daviunx

Helm chartv1.4.12App 1.19.0Verified publisher

Runs the OpenCode coding agent as a long-lived service in your cluster, web UI and HTTP API behind your own ingress, one persistent workspace per git repository, with per-workspace config, MCP servers and git sync.

About this chart

OpenCode Helm Chart

Runs the OpenCode coding agent as a long-lived service in your own Kubernetes cluster instead of on a laptop. opencode serve carries the web UI and the HTTP API on one port, so behind an ingress you open your agent in a browser from any machine, and the session keeps running after you close the laptop.

One release runs many instances. Each entry in workspaces is a separate StatefulSet with its own repository checkout, storage, model providers, MCP servers and ingress, so every repository keeps a warm clone and its own configuration. Credentials come from your cluster secret store, and an instance can be granted scoped RBAC to operate the namespace it runs in.

It is for platform and infrastructure teams who want coding agents living next to the systems those agents work on. It is published by Neomanex, an AI-native company, and it is the chart our own OpenCode instances run on in production.

helm repo add neomanexlabs https://neomanexlabs.github.io/helm-charts
helm install opencode neomanexlabs/opencode --version 1.4.12 -f my-values.yaml

Or as an OCI artifact:

helm install opencode oci://ghcr.io/neomanexlabs/charts/opencode --version 1.4.12 -f my-values.yaml

Why run it in a cluster

PropertyWhat it means
Reachable from anywhereThe web UI and the HTTP API are one server on one port, so an ingress makes the agent available from any browser, including a phone. Public exposure needs server.cors set to the UI's own origin, because the UI loads its JavaScript modules with the crossorigin attribute
Humans and machines, separatelyingress is the browser host and apiIngress is a second host for machine clients, so an SSO gate in front of one does not lock the other out. OpenCode's own HTTP Basic auth is on by default
Sessions outlive the laptopSession history and tool output live on a PersistentVolumeClaim, so closing the browser does not end the work and a pod restart resumes instead of starting over
A warm checkout per repositoryEach workspace keeps its own clone instead of cloning per session, a git-sync CronJob keeps it current, and gitSync.autosave commits and pushes agent-written paths on a schedule
Next to the systems it works onThe agent runs inside the cluster, so internal services and private registries are reachable without a hop from a laptop, and rbac.clusterReader or rbac.exposeRole let it read or expose workloads in its own namespace
Credentials stay in the clusterProvider API keys, the git deploy key and the server password come from your secret store through External Secrets Operator, never from a dotfile on a developer machine

Requirements

RequirementDetail
Kubernetes1.25 or newer, with a default StorageClass that supports dynamic provisioning (each workspace gets a PersistentVolumeClaim)
External Secrets OperatorRequired for any authenticated install: the git SSH deploy key, the provider API keys and the server password are all delivered through ESO. With externalSecrets.enabled: false the chart installs without it, but only for public repositories cloned over https and without provider keys. See "Secrets and the ESO requirement" below
Ingress controllerOptional. ingress.enabled and ingressApi.enabled are off by default; without them the service is reachable through a port-forward or from inside the cluster
Container imageghcr.io/neomanexlabs/opencode by default. Any image with git, openssh-client and a shell works; set image.repository and image.tag to use your own

Quick start

examples/minimal.yaml is the smallest set of values that installs: one workspace pointing at a public repository, no External Secrets Operator, no ingress, no server password. It is unauthenticated and meant for a port-forward on a cluster you control.

helm template opencode neomanexlabs/opencode -f examples/minimal.yaml

Read that render before installing anything. It is deliberately unauthenticated and is meant for inspection and for a port-forward on a cluster you control, never for exposure.

Secrets and the ESO requirement

Every credential the chart handles is delivered by External Secrets Operator from a ClusterSecretStore named gcp-secret-manager, through two ExternalSecret resources the chart creates when externalSecrets.enabled is true:

  • externalSecrets.sshKey becomes the opencode-ssh-key Secret, key id_ed25519, the deploy key used to clone and push every workspace repository.
  • externalSecrets.secrets becomes the opencode-secrets Secret, mounted at /etc/opencode/secrets/ and referenced from config.provider through OpenCode's {file:/etc/opencode/secrets/<key>} substitution. It also carries server-password when server.passwordAuth.enabled is on.

With externalSecrets.enabled: false nothing secret is mounted: no SSH key, no provider keys, no server password. The workspaces still install and clone, provided every repository is reachable over https without credentials, and the server answers anyone who can reach it. That mode is for trying the chart, not for running it.

A secrets mode that reads plain Kubernetes Secrets you create yourself, without External Secrets Operator, is not implemented yet. Open an issue if you need one.

How it works

Each entry in workspaces becomes its own StatefulSet, Service, ConfigMap and PersistentVolumeClaim, named after the workspace. An init container clones the workspace repository into the volume on first start and repairs permissions on every restart, then the OpenCode server runs as uid 1000 with that checkout mounted at /workspace/<name>. A per-workspace ConfigMap renders opencode.json: providers, MCP servers, per-workspace instructions, and a permission map folded from the global and per-workspace tools filters. A git-sync CronJob keeps each checkout current and, when gitSync.autosave is configured, commits and pushes agent-written paths on a schedule. Optional pieces, all off by default: NetworkPolicy, ingress for the web UI and for the API, RBAC roles that let the agent deploy or expose workloads in its own namespace, a session-cleanup CronJob, and a separate MCP deployment.

Image versions

The default image is ghcr.io/neomanexlabs/opencode: upstream OpenCode plus git, openssh-client, bash, Node.js and kubectl, running as uid 1000. Every published tag is listed on the package page.

TagMeaning
<opencode>-<n>, e.g. 1.19.0-2One build of OpenCode <opencode>. Immutable. <n> increases when the image is rebuilt on the same OpenCode version (tool bumps, security fixes)
<opencode>, e.g. 1.19.0Floats to the newest -<n> build of that OpenCode version

There is no latest tag. Every image is scanned with Trivy before it is pushed; a CRITICAL or HIGH finding with an available fix blocks the publish.

The chart defaults to an immutable -<n> tag. To pin by digest instead, set image.tag to <tag>@sha256:<digest>; the chart renders repository:tag, so the digest is carried through as written. Read the digest with docker buildx imagetools inspect ghcr.io/neomanexlabs/opencode:<tag>.

One workspace can run a different version with workspaces[].image.tag. Only the tag is per workspace; image.repository is shared by every workspace.

Limiting providers and models

OpenCode lists every model of every provider it can reach, which runs to several hundred entries once a router provider is connected. Two settings narrow the model picker, globally or per workspace:

SettingEffectPer-workspace override
config.enabledProvidersOnly these provider ids load. Every other provider is ignored, including ones OpenCode connects on its own (its free built-in provider, an API key environment variable, a key saved through the web UI)workspaces[].enabledProviders replaces the list
config.providers.<id>.whitelist / .blacklistOnly these model ids (whitelist) or all but these (blacklist) are listed for that providerworkspaces[].providerModels.<id> replaces that provider's filter

A workspace restricted to a single model:

workspaces:
  - name: app
    repo: [email protected]:example/app.git
    model: anthropic/claude-sonnet-4-6
    smallModel: anthropic/claude-sonnet-4-6
    enabledProviders: [anthropic]
    providerModels:
      anthropic:
        whitelist: [claude-sonnet-4-6]

providerModels also works for a provider that has no config.providers entry: the chart renders a block with the filter only, and OpenCode keeps resolving that provider's key on its own (environment variable or web UI). Provider and model ids are the ones in the models.dev catalog OpenCode reads; check them against the running server's GET /config/providers after a change, because providers are occasionally renamed there.

Two things to know before adding a provider for one workspace:

  • config.providers is release-wide: every entry is rendered into every workspace's opencode.json. To keep a new provider away from the other workspaces, give each of them an explicit enabledProviders list that leaves it out.
  • Every workspace StatefulSet carries a checksum of the whole rendered ConfigMap set. Any change that alters one workspace's rendered opencode.json (anything under config, or a workspace's providers, models, MCP servers or instructions) restarts every workspace pod.

Label namespace

The chart labels every workspace-scoped object with opencode.neomanex.com/workspace: <name>, and that key is part of the StatefulSet selector. Kubernetes makes selectors immutable, so this key will not be renamed inside a major version: changing it would require deleting and recreating every StatefulSet. Treat opencode.neomanex.com/* as the chart's reserved label namespace and do not set those keys yourself.

Upgrading

1.4.10 to 1.4.11

No values changes. New optional workspaces[].enabled (default true). Setting it to false removes that workspace's StatefulSet, Services, Ingresses, ConfigMap and CronJobs on the next upgrade; its PersistentVolumeClaims are kept, so turning it back on resumes the same checkout and sessions. Release-wide objects (secrets, RBAC, MCP deployments) are unchanged. Requires Helm 3.10 or newer.

1.4.9 to 1.4.10

No values changes. Every workspace pod restarts once (the git-init script changed). The init container no longer leaves git temp packs behind, and rbac.exposeRole gains read access to cert-manager objects and events plus patch on certificates/status.

1.4.8 to 1.4.9

No values changes required. The default image.tag moves from the floating 1.19.0 to the immutable 1.19.0-2 (same OpenCode version; kubectl 1.36.5 and a Trivy-scanned build). Overlays that pin image.tag keep their version.

1.4.5 to 1.4.8

No values changes required. The default image.tag moves from OpenCode 1.14.48 to 1.19.0; overlays that pin image.tag keep their version. New optional keys: config.enabledProviders, config.providers.<id>.whitelist / .blacklist, workspaces[].enabledProviders and workspaces[].providerModels (see "Limiting providers and models"). All are off by default and existing values render the same opencode.json.

1.4.0 to 1.4.1

No values changes. With externalSecrets.enabled: false the chart now renders an installable StatefulSet (the SSH key mount, the key copy and GIT_SSH_COMMAND are only rendered when ESO delivers a key). Installs with ESO on render identically to 1.4.0.

1.3 to 1.4

ChangeAction
Git commit identity is no longer hardcodedSet git.user.name and git.user.email. The defaults are OpenCode and opencode@localhost, which are valid but generic; set your own so agent commits are attributable
gitSync.push is deprecatedReplace the per-workspace gitSync.push: true with gitSync.autosave: {enabled: true, paths: [...], userName: ..., userEmail: ...}. The old key is still honored for this release, falls back to git.user.* for identity, and is removed in the next minor
rbac.clusterReaderRoleName is now required when cluster reading is enabledThe default is empty. With rbac.clusterReader: true and no name set, the render fails instead of binding a role name the chart guessed
image.repository default changedIt now points at the public ghcr.io/neomanexlabs/opencode. Overlays that already pin image.repository are unaffected

Values

KeyTypeDefaultDescription
affinityobject{}Affinity rules for the workspace pods
apiIngress.annotationsobject{}Additional annotations (merged after auto-injected cert-manager + basic-auth)
apiIngress.basicAuthobject{"enabled":false,"realm":"OpenCode API","secretKey":"server-password","secretName":"","username":"opencode"}nginx-level HTTP Basic auth for this host.
apiIngress.basicAuth.enabledboolfalseEnable nginx basic-auth annotations on the api ingress.
apiIngress.basicAuth.realmstring"OpenCode API"Realm shown in the WWW-Authenticate challenge.
apiIngress.basicAuth.secretKeystring"server-password"Key inside externalSecrets.secrets.data whose GCP Secret Manager value holds the plaintext basic-auth password. The chart reuses the SAME remote GCP secret already mapped here to render an nginx htpasswd secret via ESO (no separate GCP secret, no out-of-band htpasswd). Must reference an existing entry under externalSecrets.secrets.data.

|

Deploy opencode with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has opencode on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartopencode is pinned at v1.4.12 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply