• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 22991328127

12 Mar 2026 07:33AM UTC coverage: 64.269% (+0.1%) from 64.127%
22991328127

push

github

web-flow
Add ClusterIP service with SessionAffinity for MCP server backend (#3992)

* Add ClusterIP service with SessionAffinity for MCP server backend

The proxy-runner connects to MCP server pods through a headless service
which bypasses kube-proxy and provides no load balancing or session
affinity. If the StatefulSet scales beyond 1 replica, sessions break
because requests may hit different pods.

Add a new regular ClusterIP service (mcp-<name>) with SessionAffinity:
ClientIP alongside the existing headless service. The proxy-runner now
uses this new service as its target host, getting proper load balancing
with session stickiness. The headless service is retained for DNS
discovery.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address review feedback for MCP service session affinity

- Extract shared applyService helper to reduce duplication between
  createHeadlessService and createMCPService
- Add explicit SessionAffinityConfig.ClientIP.TimeoutSeconds (1800s)
  instead of relying on Kubernetes 3h default
- Rename SSEHeadlessServiceName to MCPServiceName across types, setup,
  and client packages
- Rename transportTypeRequiresHeadlessService to
  transportTypeRequiresBackendServices
- Extract deleteIfExists helper in operator finalizer, removing
  nolint:gocyclo
- Fix headless+NodePort conflict: skip NodePort type promotion for
  headless services (Kubernetes rejects clusterIP=None + type=NodePort)
- Use slog.Debug instead of slog.Info for service creation success paths
- Add spec.type and sessionAffinityConfig assertions to e2e tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add owner references on backend services and unit tests

Set the StatefulSet as owner of both the headless and MCP ClusterIP
services so Kubernetes garbage-collects them when the StatefulSet is
deleted. This closes the resource leak gap flagged in review.

Add table-driven unit test covering both SSE and streamable-http
transports, verifyi... (continued)

70 of 101 new or added lines in 3 files covered. (69.31%)

17 existing lines in 8 files now uncovered.

48382 of 75281 relevant lines covered (64.27%)

72.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.79
/pkg/transport/proxy/httpsse/http_proxy.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc