feat(controlplane): serve HTTP and gRPC through one ingress

Merged
MI
2mo ago
+1529-147

Summary

The control plane serves HTTP, gRPC-Web, and native gRPC on its existing HTTP endpoint, with one shared ingress hostname.
The HTTP server owns every connection and routes each request independently.
This follows the request-dispatch pattern used by etcd's shared TLS endpoint.

Existing clients keep their endpoints. The legacy gRPC listener remains enabled by default, with its own TLS configuration and deprecation flag.
CAS retains its current endpoints and native gRPC transport.

How requests flow

flowchart TD
    clients["Browsers, HTTP clients, native gRPC clients"]
    ingress["Optional shared ingress hostname<br/>One root path, HTTP/2 upstream"]
    http["HTTP server owns server.http.addr<br/>HTTP/1.1, HTTP/2, h2c, optional TLS<br/>Dispatch every request"]
    grpc["Native gRPC request over HTTP/2<br/>grpc.Server.ServeHTTP"]
    web["Existing gRPC-Web wrapper<br/>Including CORS preflight"]
    routes["Existing HTTP routes"]
    rpc["Existing RPC services and interceptors"]
    legacy["Legacy server.grpc.addr<br/>Native grpc.Server.Serve<br/>Enabled by default"]

    clients --> ingress --> http
    clients -->|"Direct VM or Compose access"| http
    http --> grpc --> rpc
    http --> web --> rpc
    http --> routes
    clients -->|"Existing gRPC endpoint"| legacy --> rpc

The dispatcher checks each request's HTTP version and content type.
Native gRPC uses grpc-go's HTTP adapter. gRPC-Web and preflight reach the existing wrapper. Other requests reach the existing HTTP routes.
HTTP/2 streams can mix these request types in either order on one connection.

This removes cmux, the connection classifier, frame replay, and custom SETTINGS/ACK handoff code.
The standard HTTP server handles connection setup, HTTP/2 framing, and TLS.
Shutdown drains HTTP requests before stopping the gRPC handler.

Helm ingress

An enabled controlplane.ingress exposes all three protocols through its existing HTTP Service and root path.
There is no additional gRPC enable flag and no client migration in this change.

  • Community ingress-nginx: nginx.ingress.kubernetes.io/backend-protocol: GRPC sends all requests upstream over HTTP/2.
  • F5 NGINX and NGINX Plus: nginx.org/grpc-services names the shared Service, with nginx.org/http2: "true".
  • Traefik: the shared HTTP Service uses traefik.ingress.kubernetes.io/service.serversscheme: h2c.

Ordinary HTTP clients can continue to use HTTP/1.1 at the ingress.
The separate ingressAPI settings and legacy hostname remain available.
The chart documentation covers controller prerequisites and overrides for TLS between the ingress and pod.
For ingress-nginx, all backends in this Ingress must accept HTTP/2, including custom extraPaths.
The chart version changes to 1.468.1.

Spec and scope

Spec issue-3628-controlplane-http-dispatch records the replacement design.
It supersedes the control-plane parts of the original D-004, D-014, D-015, and D-016 from spec #3629.
The original spec links to this replacement and retains its historical decisions.
The new spec's R-001 through R-004 cover the shared endpoint, behavior parity, compatibility, and ingress.

CAS migration remains separate work under #3628.
The HTTP adapter's read-ahead behavior prevents an unqualified bounded-memory claim for CAS ByteStream uploads.
The original R-003 benchmark remains required before choosing a shared CAS transport.

Validation and limits

Race-enabled server, application-wiring, and Helm rendering tests pass.
They cover mixed HTTP/2 connection reuse over plaintext and TLS, gRPC-Web, CORS, reflection streams, request metadata, shutdown, and independent legacy TLS.
NGINX Open Source 1.28.0 and 1.23.3 pass the shared grpc_pass integration test with HTTP/1.1 and HTTP/2 browser clients after native gRPC.
Chart tests cover defaults, custom names, upstream protocol overrides, and independent legacy and CAS ingress backends.
Formatting, golangci-lint 2.14.0, Helm lint, and spec prose checks pass.

Authenticated manual protocol check

Tested the running control-plane shared HTTP listener on port 8000 using buf curl 1.61.0, with the configured bearer token and organization header. Called /controlplane.v1.WorkflowService/List with {"pagination":{"page":1,"pageSize":1}}. Local Protobuf descriptors supplied the schema for the protocol matrix, so these results do not depend on reflection.

RPC protocolHTTP transportObserved result
Native gRPCHTTP/2, plaintext h2cPassed: HTTP 200, gRPC status 0, one workflow returned
gRPC-WebHTTP/1.1Passed: successful RPC, one workflow returned
gRPC-WebHTTP/2, plaintext h2cPassed: successful RPC, one workflow returned
ConnectHTTP/1.1HTTP 404, expected because the Connect wire protocol is not implemented
ConnectHTTP/2, plaintext h2cHTTP 404, expected because the Connect wire protocol is not implemented

A separate native gRPC call using authenticated server reflection also passed over h2c. Attempting native gRPC over HTTP/1.1 was rejected by Buf before making a request; native gRPC requires HTTP/2. buf curl defaults to Connect, so callers must explicitly select --protocol grpc or --protocol grpcweb for this endpoint.

These are direct, authenticated unary RPC checks. They do not exercise an ingress controller, TLS, mixed-protocol reuse of one connection, the legacy listener, or CAS ByteStream uploads, and are not a performance benchmark. Credentials, organization identifiers, and workflow contents are omitted from this report.

Alignment evidence limitation: the full original R-002 authentication and authorization matrix remains outstanding.
Focused tests do not establish full spec alignment.
Deployed Kubernetes controller tests, including F5 NGINX Plus and Traefik, remain outstanding.
The CAS migration and original R-003 1 GB benchmark remain outstanding.

Refs #3628, spec #3629.

AI assistance: Codex.