[Proposal] Introduce RuntimeDeployConfig as Kind-Agnostic IR in Gateway Controller #1365
renuka-fernando
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
RuntimeDeployConfigas a new kind-agnostic intermediate representation (IR) in the gateway controller, replacing the current pattern where all deployment kinds (RestAPI, LLM Provider, LLM Proxy, MCP) are internally converted toRestAPIConfigTransformerimplementation that producesRuntimeDeployConfigfrom stored configurationRuntimeDeployConfigexclusively, decoupled from any specific API kindPolicyChainResolveras a named, registered component in the Policy Engine that determines which policy chain applies to a given request, enabling kind-specific resolution strategies (e.g., route-key based vs. JSON-RPC body parsing)prototext.Unmarshalparsing at request time (performance improvement)RouteConfigresources alongside the existingPolicyChaincacheProposal
RuntimeDeployConfigas the single IR struct that all xDS translators consumeConfigTransformerinterface per kind:RestAPITransformer,LLMTransformer,MCPTransformerRestAPIusage inCreateRoute,CreateCluster, and policy snapshot generation withRuntimeDeployConfigPolicyChainResolveras a pluggable component in the Policy Engine, withroute-keyandmcp-toolas the initial implementationsRouteConfig(metadata + resolver name) andPolicyChain(existing)Key Design Decisions
RuntimeDeployConfig as the central IR
The struct captures everything the xDS translators need to configure Envoy and the Policy Engine without knowing which kind produced the configuration. The
Contextfield is empty for kinds like LLM Proxy that have no base path concept. ThePolicyChainResolverfield declares which resolver the Policy Engine should use for this deployment.PolicyChainResolver in the Policy Engine
The resolver is a named, registered component that determines which policy chain to apply for a given request. Like a policy, it declares what request data it needs before it can run:
route-keypolicyChainKey = routeKeymcp-toolThis directly impacts the ext_proc flow:
Two xDS caches in the Policy Engine
Routesmap +Metadata+PolicyChainResolverPolicyChainsmapThe split means that at request time, the Policy Engine receives only the
routeKeyfrom Envoy. It looks up theRouteConfigto get pre-populated metadata (no parsing) and the resolver name. The resolver then determines the policy chain key, and the chain is looked up from the second cache.Metadata delivery via xDS (not Envoy route metadata)
Currently,
createRouteinjects dynamic metadata (api_id,api_name,api_version,api_kind, etc.) into Envoy routes. At request time, Envoy forwards this to the Policy Engine via ext_proc, which runsextractRouteMetadata()involvingprototext.Unmarshal(expensive, ~11% CPU, required a cache).With this proposal, metadata is sent directly to the Policy Engine via the
RouteConfigxDS resource at deployment time. It is stored in memory and looked up byrouteKeyat request time. No parsing, no cache needed.PolicyChain resolution by kind
route-keypolicyChainKey = routeKey(e.g.GET_petstore_v1_/pets_{id})route-keyroute-keymcp-toolDrawbacks
translator.go) is one of the largest files in the gateway controller. Refactoring it to consumeRuntimeDeployConfiginstead ofRestAPIis a significant change that touches critical code paths.RouteConfigcache introduces additional snapshot management, versioning, and debugging surface area.mcp-toolresolver requires full request body buffering before chain resolution, which adds latency for MCP requests. This is inherent to the JSON-RPC protocol and unavoidable, but it is a tradeoff that does not exist for other kinds.RestAPIwhile others useRuntimeDeployConfig, creating two parallel paths to maintain.Beta Was this translation helpful? Give feedback.
All reactions