Skip to content

feat(workspaces): give a kubernetes workspace its own Secrets - #1758

Merged
edenreich merged 1 commit into
mainfrom
feat/workspace-secrets
Nov 8, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/workspace-secrets

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Resolves #1756

Summary

Each agent should run on its own computer with its own secrets. With twelve agents on twelve Kubernetes workspaces, each pod daemon needs its own AGENTMAIL_API_KEY, and that key should live in the cluster, not on the machine that opens the thread.

None of the existing fields fit:

  • env is plain text in the Orchestrator.
  • gateway_env writes this machine's provider keys into the Gateway's Secret.
  • forward_env seals this machine's values to the pod on every teleport.

A Kubernetes workspace now names existing Secrets in its namespace:

workspaces:
  - name: code-reviewer
    kind: kubernetes
    namespace: agents
    secrets:
      - code-reviewer-credentials

Changes

  • config/daemon.go: WorkspaceEntry gains secrets. Setting it on any kind but kubernetes fails validation, like gateway_env does.
  • internal/agent/infrastructure/kubernetes/workspace.go:
    • create reads each listed Secret and passes one secretKeyRef env item per key, sorted, to the Orchestrator. They come after the daemon's own variables and the entry's env.
    • The Orchestrator CRD's spec.env is already a full EnvVar passthrough, so the operator needs no change.
    • The pod resolves the values itself. They never pass through this machine, and a rotated value reaches the next pod start.
    • A missing Secret fails the teleport before anything is created, naming the Secret and the namespace.
  • Docs: a secrets bullet in docs/daemon.md with a per-agent example, and the field in the configuration reference.

A daemon-kind workspace needs nothing new. Its secrets are the environment its infer daemon runs with.

Verification

  • A table test on create covers no secrets, every key of two Secrets in order with no value in the Orchestrator, and a missing Secret creating nothing.
  • A validation case rejects secrets on a daemon kind.
  • go test -race ./config/ ./internal/agent/... passes, go test ./... passes, and so do the pre-commit hook and lint.
  • Not run against a live cluster.

Docs follow-up: inference-gateway/docs#1128.

A kubernetes workspace accepts `secrets`, naming Secrets in its namespace. When a session's Orchestrator is created, every key of each becomes a `spec.env` item with a `secretKeyRef`, so the pod daemon, its workers and the `${VAR}`s of its mcp.yaml see them while the values stay in the cluster and never pass through this machine.

Each agent on its own workspace now holds its own credentials, such as an AgentMail key. A missing Secret fails the teleport before anything is created, and `secrets` on any other kind fails validation.

Closes #1756
@edenreich
edenreich requested a review from a team as a code owner November 8, 2026 14:38
@github-project-automation github-project-automation Bot moved this to Todo in 2026 Nov 8, 2026
@edenreich
edenreich merged commit ac1082b into main Nov 8, 2026
1 check passed
@edenreich
edenreich deleted the feat/workspace-secrets branch November 8, 2026 14:58
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.248.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Kubernetes workspace secrets from existing cluster Secrets

1 participant