mirror of https://github.com/grpc/grpc-node.git
grpc-js-xds: Remove env var protection for routing feature
This commit is contained in:
parent
c3aeb94b8c
commit
abfe46b99d
|
@ -14,9 +14,3 @@
|
|||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Environment variable protection for traffic splitting and routing
|
||||
* https://github.com/grpc/proposal/blob/master/A28-xds-traffic-splitting-and-routing.md#xds-resolver-and-xds-client
|
||||
*/
|
||||
export const GRPC_XDS_EXPERIMENTAL_ROUTING = (process.env.GRPC_XDS_EXPERIMENTAL_ROUTING === 'true');
|
|
@ -30,7 +30,6 @@ import { Listener__Output } from './generated/envoy/api/v2/Listener';
|
|||
import { Watcher } from './xds-stream-state/xds-stream-state';
|
||||
import { RouteConfiguration__Output } from './generated/envoy/api/v2/RouteConfiguration';
|
||||
import { HttpConnectionManager__Output } from './generated/envoy/config/filter/network/http_connection_manager/v2/HttpConnectionManager';
|
||||
import { GRPC_XDS_EXPERIMENTAL_ROUTING } from './environment';
|
||||
import { CdsLoadBalancingConfig } from './load-balancer-cds';
|
||||
import { VirtualHost__Output } from './generated/envoy/api/v2/route/VirtualHost';
|
||||
import { RouteMatch__Output } from './generated/envoy/api/v2/route/RouteMatch';
|
||||
|
@ -288,7 +287,6 @@ class XdsResolver implements Resolver {
|
|||
|
||||
private handleRouteConfig(routeConfig: RouteConfiguration__Output) {
|
||||
this.latestRouteConfig = routeConfig;
|
||||
if (GRPC_XDS_EXPERIMENTAL_ROUTING) {
|
||||
const virtualHost = findVirtualHostForDomain(routeConfig.virtual_hosts, this.target.path);
|
||||
if (virtualHost === null) {
|
||||
this.reportResolutionError('No matching route found');
|
||||
|
@ -376,28 +374,6 @@ class XdsResolver implements Resolver {
|
|||
loadBalancingConfig: [lbPolicyConfig]
|
||||
}
|
||||
this.listener.onSuccessfulResolution([], serviceConfig, null, configSelector, {});
|
||||
} else {
|
||||
// !GRPC_XDS_EXPERIMENTAL_ROUTING
|
||||
for (const virtualHost of routeConfig.virtual_hosts) {
|
||||
if (virtualHost.domains.indexOf(this.target.path) >= 0) {
|
||||
const route = virtualHost.routes[virtualHost.routes.length - 1];
|
||||
if (route.match?.prefix === '' && route.route?.cluster) {
|
||||
trace('Reporting RDS update for host ' + uriToString(this.target) + ' with cluster ' + route.route.cluster);
|
||||
this.listener.onSuccessfulResolution([], {
|
||||
methodConfig: [],
|
||||
loadBalancingConfig: [
|
||||
new CdsLoadBalancingConfig(route.route.cluster)
|
||||
],
|
||||
}, null, null, {});
|
||||
this.hasReportedSuccess = true;
|
||||
return;
|
||||
} else {
|
||||
trace('Discarded matching route with prefix ' + route.match?.prefix + ' and cluster ' + route.route?.cluster);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.reportResolutionError('No matching route found');
|
||||
}
|
||||
}
|
||||
|
||||
private reportResolutionError(reason: string) {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
import { experimental, logVerbosity, StatusObject } from "@grpc/grpc-js";
|
||||
import { GRPC_XDS_EXPERIMENTAL_ROUTING } from "../environment";
|
||||
import { RouteConfiguration__Output } from "../generated/envoy/api/v2/RouteConfiguration";
|
||||
import { CdsLoadBalancingConfig } from "../load-balancer-cds";
|
||||
import { Watcher, XdsStreamState } from "./xds-stream-state";
|
||||
|
@ -99,7 +98,6 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
|
|||
}
|
||||
|
||||
validateResponse(message: RouteConfiguration__Output): boolean {
|
||||
if (GRPC_XDS_EXPERIMENTAL_ROUTING) {
|
||||
// https://github.com/grpc/proposal/blob/master/A28-xds-traffic-splitting-and-routing.md#response-validation
|
||||
for (const virtualHost of message.virtual_hosts) {
|
||||
for (const domainPattern of virtualHost.domains) {
|
||||
|
@ -145,9 +143,6 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private handleMissingNames(allRouteConfigNames: Set<string>) {
|
||||
|
|
Loading…
Reference in New Issue