Repository navigation
feat(workspaces): Kubernetes workspaces give their pods MCP servers - #1767
Merged
Merged
Conversation
A Kubernetes workspace's mcp_servers names hosted servers of this
machine's ~/.infer/mcp.yaml its pods get. When a session's Orchestrator
is created, each one goes into spec.mcp.hostedServers with its name, URL
and headers, and MCP is switched on for the pod.
mcp.yaml is read as written, so a header stays a ${VAR} reference the
pod expands from the workspace's Secrets. A header that holds a value, a
container server and a name mcp.yaml lacks fail before the Orchestrator
is created, so no secret lands in a Kubernetes object. An operator that
refuses the field fails the create with the upgrade error naming the
release that renders hosted servers.
The session-teleport example gains a k8s-mcp workspace with the demo MCP
server deployed in the cluster.
Closes #1760
…ervers The operator gives the pod MCP servers through spec.mcp.servers entries with a name, a URL and headers, so the Orchestrator carries them there. An older operator types those entries as strings and refuses them as invalid, which now also reads as the upgrade error.
edenreich
marked this pull request as ready for review
November 8, 2026 22:22
edenreich
added a commit
that referenced
this pull request
Nov 8, 2026
…operator's api/v1alpha1 (#1770) ## Summary The Kubernetes workspace adapter copied the Orchestrator's status contract as string literals, so a renamed value in the operator would break a teleport without a compile error. Operator v0.33.0 exports the contract from `api/v1alpha1` (inference-gateway/operator#322), and the adapter now reads it from there: - `readyCondition` in `workspace.go` matches the condition type `OrchestratorConditionReady`. - `unrecoverableReasons` in `workspace.go`, the reasons a teleport fails fast on, are `ReasonSandboxCRDMissing` and `ReasonInvalidSpec`. - `ReportIdle` in `self.go` writes `AgentsDoneMessage` when every agent is done. The fail-fast list keeps the same two reasons. Their doc comments in the operator say they need a change to the cluster or the spec. `ReasonSandboxSuspended` needs a spec change too, but `awaitReady` makes it itself by resuming the Orchestrator, and the doc comment now says so. `GatewayNotFound`, `SandboxNotReady` and `DeploymentNotAvailable` can clear on their own, so a teleport keeps waiting on them. Closes #1769 ## Dependency - `go.mod` requires `github.com/inference-gateway/operator` v0.33.0. It uses the same `k8s.io` v0.37.2 modules as the CLI, adds `sigs.k8s.io/gateway-api` as an indirect dependency, and moves `github.com/google/gnostic-models` from v0.7.0 to v0.7.1. - The stripped `purego` binary grows by about 0.87MB, from 81.92MB to 82.79MB. - The `kubernetes-only-in-the-kubernetes-adapters` depguard rule now also confines `github.com/inference-gateway/operator` to the two Kubernetes adapters. An import from `internal/sessions` is refused by that rule. - `operatorv1alpha1` joins the canonical aliases in `AGENTS.md`, and `internal/agent/README.md` names the operator's API types beside client-go. ## Compatibility The values are unchanged, so every operator release that reports them keeps working. The workspace tests still build their fake Orchestrators and expected termination messages from the literal strings, so they pin the wire values the adapter has to match. ## Verification - `task test` passes. - `task test:e2e`: every test passes except `TestChatTUIAnswersAQuestion`, which failed in both full runs. It is flaky without this change: run alone, it failed one of three runs on the commit before #1767 and one of three on main. It passes when run alone on this branch twice. - `task precommit:run` passes. no docs ticket: internal-only refactor
Contributor
|
🎉 This PR is included in version 0.250.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 names the hosted MCP servers of this machine's
~/.infer/mcp.yamlits pods get, and the adapter writes them into each new Orchestrator:mcp_serversis accepted on a Kubernetes workspace, also one placed on a cluster throughcompute. Any other kind fails validation, likesecrets.spec.mcp.serverswith its name, URL and headers, andspec.mcp.enabledis set.mcp.yamlis read as written (LoadMCPForEdit), so a header stays a${VAR}reference the pod expands from its ownsecrets. A header that holds a value rather than a reference is refused with an error naming the server and the header, never the value, so no secret lands in a Kubernetes object.mcp.yamllacks and a container server (run: true) fail with an error naming the server before the Orchestrator is created.spec.mcp.serversentries as strings and refuses the create as invalid. That now also reads as the existing "may predate ..., upgrade it" error, naming v0.33.0.secrets, so running sessions keep theirs.Closes #1760
Draft: waiting on the operator
This writes
spec.mcp.serversentries with aname, aurlandheaders, the shape inference-gateway/operator#324 gives the field, which no operator release has yet. Until it ships, a workspace withmcp_serversfails its teleport with the upgrade error and every other workspace is unaffected.newFieldsOperatorVersionis v0.33.0, the next operator release, whichbinding_servicealready needs. It has to follow the release operator#324 actually lands in.Tests
TestCreateGivesThePodTheNamedMCPServersAsWrittenrunscreateagainst a fake cluster: no servers leavesspec.mcpunset, named servers carry their URLs and header references (a URL built from scheme, host, port and path included), and a missing name, a container server and a header holding a value fail without creating anything. The header's variable is set in the test's environment, and its value never reaches the Orchestrator.TestCreateNamesTheOperatorVersionMCPServersNeedchecks the upgrade error when an older operator refuses the entries as invalid. The 422 there is modeled on the apiserver's schema error, not captured from a live older operator.mcp_serverson a local workspace and on a workspace placed throughcompute.task test:e2e,task precommit:runandgo test ./...pass. The e2e suite does not run Kubernetes workspaces, and no cluster with an operator that renders hosted servers exists yet.Example and docs
examples/session-teleportgains ak8s-mcpworkspace. It gets the demo MCP server fromexamples/mcp, deployed into the cluster withtask mcp:install, behind anx-api-key: ${DEMO_MCP_KEY}header the pod fills from thedemo-mcp-credentialsSecret.task mcp:statusrunsinfer mcp statusin the pod. The walkthrough states it needs operator v0.33.0 or newer.docs/daemon.mddocumentsmcp_serversbesidesecrets, with the AgentMail example.Known gaps
secretsentry already does. A retry reuses it.${VAR}in a server'sportstill cannot be read as written, the gap noted in fix(config): keep ${VAR} references when a command edits a config file #1765.Cross-repo impact
operator: feat(orchestrator): give spec.mcp.servers names and headers in the pod's mcp.yaml operator#324 rendersspec.mcp.serversinto the pod'smcp.yaml. This PR depends on it.desktop: feat(settings): manage MCP servers in an MCPs tab and let agents pick theirs desktop#480 writesmcp_serversunder a workspace indaemon.yaml, the shape this reads.docs: [DOCS] CLI Kubernetes workspaces give their pods MCP servers with mcp_servers docs#1146 documentsmcp_serverson Kubernetes workspaces.