Skip to content

feat(teleport): deploy a gateway per kubernetes workspace that holds the provider keys - #1667

Merged
edenreich merged 1 commit into
mainfrom
feat/teleport-workspace-gateway
Oct 31, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/teleport-workspace-gateway

Conversation

@edenreich

@edenreich edenreich commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A Kubernetes workspace can keep the provider keys away from its agents. In the default standard mode a teleport deploys one operator Gateway per workspace beside its sessions and writes the keys listed under gateway_env into the gateway's Secret. The agent's pod only learns the gateway URL, so nothing the agent runs can read a key into its context. mode: all-in-one runs the gateway inside the pod instead, which costs one pod less and leaves the keys readable by the agent.

This covers the "Deploy the gateway separately per workspace" todo on #1653.

Changes

  • Config: the workspace entry gains mode (standard or all-in-one, empty is standard) and gateway_env. Both are rejected on any kind but kubernetes. config.Credentials resolves names like the local gateway does, the environment first and then ~/.infer/auth.yaml.
  • internal/agent/infrastructure/kubernetes/gateway.go
    • ensureGateway writes the credentials Secret and creates or updates the Gateway, both owned by every session's Orchestrator, so garbage collection removes them with the last session.
    • A key unset on the teleporting daemon keeps the value an earlier teleport stored. Names no longer listed are dropped.
    • A credentials-revision counter on the Secret only moves when a value changes. The Gateway carries it as an env var, so a rotated key rolls the gateway and a new session does not.
    • awaitGateway waits for an available gateway pod before the restore, which already imports the conversation through it. If the operator never deploys it, the error names its WATCH_NAMESPACE_SELECTOR.
    • The Gateway pins spec.server.port: 8080, the port the pod's INFER_GATEWAY_URL names.
  • workspace.go: the Orchestrator's spec.gateway.url points at the workspace gateway in standard, at 127.0.0.1:8080 in all-in-one, and stays unset without gateway_env. Only a teleport writes credentials, never a relay.
  • internal/agent/teleport: workerEnv seals forward_env and, in all-in-one, the gateway_env keys plus INFER_GATEWAY_RUN and INFER_GATEWAY_STANDALONE_BINARY. Those beat the operator's pod-level INFER_GATEWAY_RUN=false because worker env is appended last.
  • Example: a k8s-cloud workspace on ollama_cloud/glm-5.3-flash with gateway_env: [OLLAMA_CLOUD_API_KEY], and the namespace carries inference-gateway.com/managed=true for the operator.
  • Docs: docs/daemon.md (modes, credential sources, RBAC for gateways, deployments and Secret update, the namespace label), the configuration reference, the session-teleport README and the agent README.

Cross-repo

Out of scope

  • all-in-one keeps the sealed keys in the pod daemon's memory, as forward_env already does. A pod resumed by a relay after idling out has no keys until the next teleport. standard doesn't have this gap since its Secret persists.
  • No gateway auth or NetworkPolicy and no gateway image pin. kind: daemon workspaces keep their own gateway config.

Test plan

  • go test for config, internal/agent/teleport and internal/agent/infrastructure/kubernetes
  • task precommit:run
  • TestEnsureGatewayKeepsCredentialsOnTheGateway: the Secret holds only set keys, owners accumulate, the revision only moves on a changed key, an unset key keeps the stored value, and the auth file is a fallback. The Gateway and Orchestrator never carry a key's value.
  • TestAwaitGateway, TestWorkerEnv, TestOrchestratorPointsTheWorkersAtTheGateway, TestCredentialsPreferTheEnvironmentOverTheAuthFile, TestDaemonConfigValidate
  • k3d session-teleport example with ollama_cloud/glm-5.3-flash and the key from ~/.infer/auth.yaml. The pod's turn answered through the gateway, no process in the agent pod held OLLAMA_CLOUD_API_KEY and the Secret did. A second session shared the gateway pod without a rollout. infer daemon stop on both left the namespace empty.
  • all-in-one against a cluster

…the provider keys

A kubernetes workspace entry gains mode and gateway_env. In the default
standard mode a teleport deploys one operator Gateway per workspace beside
its sessions and writes the gateway_env keys into the gateway's Secret, so
the agent's pod only learns the gateway URL and can never read the keys
into its context. all-in-one runs the gateway inside the pod instead.

The keys come from the daemon's environment, else ~/.infer/auth.yaml, like
the local gateway's. Every session's Orchestrator owns the Gateway and its
Secret, so both go with the last session. A teleport waits for the gateway
to serve before it restores, and a changed key rolls the gateway.
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.239.0-rc.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the rc Shipped in a release candidate label Oct 31, 2026
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.239.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Oct 31, 2026
@edenreich edenreich moved this from Todo to Done in 2026 Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rc Shipped in a release candidate released Shipped in a release

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant