Consolidate route-vhost config: gateway_host (WebSub) vs vhosts (REST)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Description
The platform derives a route's vhost from two different config keys depending on which half of the gateway handles the request, which is inconsistent and confusing.
- Main gateway (REST / LLM / MCP): the route vhost comes from
router.vhosts.main/router.vhosts.sandbox. Therouter.gateway_hostvalue is never read on this path. - Event gateway (WebSub): the route vhost comes from
router.gateway_host. Thevhostsconfig is never read on this path.
So the same conceptual field — "the vhost segment of a route key" — is sourced from vhosts in one component and gateway_host in the other.
Evidence:
- Event gateway uses
gateway_hostas the vhost when building SUB/UNSUB policy-chain route keys:event-gateway/gateway-controller/pkg/policyhooks/event_channel_translator.go:368and:399callxds.GenerateRouteName("SUB"/"UNSUB", apiData.Context, apiData.Version, chName, routerConfig.GatewayHost). GenerateRouteName(method, context, apiVersion, path, vhost string)(gateway/gateway-controller/pkg/xds/translator.go:168) uses that 5th argument as the route key's vhost segment.- The event-gateway shares the main controller's config struct (
event_channel_translator.go:32importsgithub.com/wso2/api-platform/gateway/gateway-controller/pkg/config), so both keys live on the sameRouterConfig. - The main gateway's REST/LLM/MCP translation uses
getVHostDomains/ thevhostsconfig exclusively (gateway/gateway-controller/pkg/xds/translator.go:974-1013) and never readsGatewayHost.
Important: gateway_host is therefore NOT dead config — it is load-bearing for event-gateway route naming. It is only unused within the main gateway, which makes it look removable at a glance. Removing it would break WebSub route-key generation.
Why this matters
An operator configuring the gateway sees both router.gateway_host and router.vhosts.* and has no way to tell that one governs WebSub and the other governs REST. Changing gateway_host has no effect on REST APIs; changing vhosts has no effect on WebSub. This is closely related to the default vs domains confusion tracked in #3321.
Proposal (pick/refine)
- Preferred: unify the WebSub route-vhost derivation with the same
vhostsconfig the main gateway uses, so there is a single source of truth for a route's vhost, and deprecaterouter.gateway_host. - Or, if they must stay separate: document explicitly that
gateway_hostgoverns only the event-gateway (WebSub) andvhostsgoverns only REST/LLM/MCP, and consider validating/warning when one is set in a deployment that doesn't use it. - Either way, add a code comment on
RouterConfig.GatewayHost(gateway/gateway-controller/pkg/config/config.go:542) noting it is consumed by the event-gateway, so it is not mistaken for dead config and removed.
Affected areas
gateway/gateway-controller/pkg/config/config.go(RouterConfig.GatewayHost)event-gateway/gateway-controller/pkg/policyhooks/event_channel_translator.gogateway/gateway-controller/pkg/xds/translator.go(GenerateRouteName,getVHostDomains)kubernetes/helm/gateway-helm-chart/values.yaml+templates/gateway/gateway-config.yamlkubernetes/helm/operator-helm-chart/values.yaml,kubernetes/gateway-operator/config/*
Version
No response
Related Issue
Related to #3321 and #403 (which introduced the vhosts config for the main gateway, leaving gateway_host used only by the event-gateway).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading RouterConfig.GatewayHost in gateway/gateway-controller/pkg/config/config.go, the GenerateRouteName and getVHostDomains paths in gateway/gateway-controller/pkg/xds/translator.go, and the WebSub call sites in event-gateway/gateway-controller/pkg/policyhooks/event_channel_translator.go. Then inspect the listed Helm and operator configuration files; done means the chosen vhost configuration behavior is consistent or explicitly documented, with affected configuration and safeguards updated without breaking WebSub route keys.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, helm, kubernetes
- Domain
- api, backend, infrastructure
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100