Repository navigation
feat(teleport): deploy a gateway per kubernetes workspace that holds the provider keys - #1667
Merged
Merged
Conversation
…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.
4 tasks
Contributor
|
🎉 This PR is included in version 0.239.0-rc.10 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 0.239.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
A Kubernetes workspace can keep the provider keys away from its agents. In the default
standardmode a teleport deploys one operatorGatewayper workspace beside its sessions and writes the keys listed undergateway_envinto 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-oneruns 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
mode(standardorall-in-one, empty is standard) andgateway_env. Both are rejected on any kind but kubernetes.config.Credentialsresolves names like the local gateway does, the environment first and then~/.infer/auth.yaml.internal/agent/infrastructure/kubernetes/gateway.goensureGatewaywrites the credentials Secret and creates or updates theGateway, both owned by every session's Orchestrator, so garbage collection removes them with the last session.credentials-revisioncounter 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.awaitGatewaywaits for an available gateway pod before the restore, which already imports the conversation through it. If the operator never deploys it, the error names itsWATCH_NAMESPACE_SELECTOR.spec.server.port: 8080, the port the pod'sINFER_GATEWAY_URLnames.workspace.go: the Orchestrator'sspec.gateway.urlpoints at the workspace gateway instandard, at127.0.0.1:8080inall-in-one, and stays unset withoutgateway_env. Only a teleport writes credentials, never a relay.internal/agent/teleport:workerEnvsealsforward_envand, inall-in-one, thegateway_envkeys plusINFER_GATEWAY_RUNandINFER_GATEWAY_STANDALONE_BINARY. Those beat the operator's pod-levelINFER_GATEWAY_RUN=falsebecause worker env is appended last.k8s-cloudworkspace onollama_cloud/glm-5.3-flashwithgateway_env: [OLLAMA_CLOUD_API_KEY], and the namespace carriesinference-gateway.com/managed=truefor the operator.docs/daemon.md(modes, credential sources, RBAC forgateways,deploymentsand Secretupdate, the namespace label), the configuration reference, the session-teleport README and the agent README.Cross-repo
spec.servershows no port and itsstatus.urlomits 8080. The CLI sets the port explicitly meanwhile.gateway_envand the Kubernetes prerequisites.Out of scope
all-in-onekeeps the sealed keys in the pod daemon's memory, asforward_envalready does. A pod resumed by a relay after idling out has no keys until the next teleport.standarddoesn't have this gap since its Secret persists.kind: daemonworkspaces keep their own gateway config.Test plan
go testforconfig,internal/agent/teleportandinternal/agent/infrastructure/kubernetestask precommit:runTestEnsureGatewayKeepsCredentialsOnTheGateway: 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,TestDaemonConfigValidateollama_cloud/glm-5.3-flashand the key from~/.infer/auth.yaml. The pod's turn answered through the gateway, no process in the agent pod heldOLLAMA_CLOUD_API_KEYand the Secret did. A second session shared the gateway pod without a rollout.infer daemon stopon both left the namespace empty.all-in-oneagainst a cluster