wso2 / wso2/api-platform

refactor(gateway-xds): remove or wire unused defaultCluster parameter in createRoute

Open
#2,062 0 comments 0 reactions 1 assignee View on GitHub

@renuka-fernando is already working on this.

Since May 31, 2026.

Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Summary

The createRoute function in gateway/gateway-controller/pkg/xds/translator.go accepts a defaultCluster parameter, but the parameter is not used when building the Envoy RouteAction. As a result, routes emitted with useClusterHeader=true are pure cluster_header routes with no fallback cluster, meaning requests that do not carry the x-target-upstream header (i.e., those without a dynamic-endpoint policy) will not fall back to the intended default cluster (e.g., the sandbox cluster).

Context

This was identified during the review of #2059, which introduced sandbox dynamic-cluster routing. The sbDefaultCluster value (the sandbox cluster name) is computed and passed into createRoute, but the function does not emit it into the route. The team has acknowledged this and intends to address it in a follow-up PR.

See: https://github.com/wso2/api-platform/pull/2059#discussion_r3329716770

Affected files

  • gateway/gateway-controller/pkg/xds/translator.gocreateRoute function and callers in translateAPIConfig
  • gateway/gateway-controller/pkg/transform/restapi.go — parallel Transform path for sandbox routes

Suggested action

Either:

  1. Wire defaultCluster into the emitted Envoy route action so requests without a dynamic-endpoint policy fall back to the specified cluster, or
  2. Remove the defaultCluster parameter entirely if a fallback is not needed and document the expected behavior.

Requested by @renuka-fernando.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.