mirror of https://github.com/grpc/grpc-node.git
Merge pull request #1707 from murgatroid99/grpc-js-xds_lrs_server_name_fix
grpc-js-xds: Fix handling of empty LRS server names
This commit is contained in:
commit
5b362bead1
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/grpc-js-xds",
|
"name": "@grpc/grpc-js-xds",
|
||||||
"version": "1.2.2",
|
"version": "1.2.3",
|
||||||
"description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.",
|
"description": "Plugin for @grpc/grpc-js. Adds the xds:// URL scheme and associated features.",
|
||||||
"main": "build/src/index.js",
|
"main": "build/src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
"@grpc/proto-loader": "^0.6.0-pre14"
|
"@grpc/proto-loader": "^0.6.0-pre14"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@grpc/grpc-js": "~1.2.7"
|
"@grpc/grpc-js": "~1.2.10"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.10.0"
|
"node": ">=10.10.0"
|
||||||
|
|
|
@ -52,7 +52,7 @@ GRPC_NODE_TRACE=xds_client,xds_resolver,cds_balancer,eds_balancer,priority,weigh
|
||||||
GRPC_NODE_VERBOSITY=DEBUG \
|
GRPC_NODE_VERBOSITY=DEBUG \
|
||||||
NODE_XDS_INTEROP_VERBOSITY=1 \
|
NODE_XDS_INTEROP_VERBOSITY=1 \
|
||||||
python3 grpc/tools/run_tests/run_xds_tests.py \
|
python3 grpc/tools/run_tests/run_xds_tests.py \
|
||||||
--test_case="backends_restart,change_backend_service,gentle_failover,ping_pong,remove_instance_group,round_robin,secondary_locality_gets_no_requests_on_partial_primary_failure,secondary_locality_gets_requests_on_primary_failure" \
|
--test_case="backends_restart,change_backend_service,gentle_failover,ping_pong,remove_instance_group,round_robin,secondary_locality_gets_no_requests_on_partial_primary_failure,secondary_locality_gets_requests_on_primary_failure,load_report_based_failover" \
|
||||||
--project_id=grpc-testing \
|
--project_id=grpc-testing \
|
||||||
--source_image=projects/grpc-testing/global/images/xds-test-server-2 \
|
--source_image=projects/grpc-testing/global/images/xds-test-server-2 \
|
||||||
--path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \
|
--path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \
|
||||||
|
|
|
@ -377,7 +377,7 @@ export class EdsLoadBalancer implements LoadBalancer {
|
||||||
validateLoadBalancingConfig({ round_robin: {} }),
|
validateLoadBalancingConfig({ round_robin: {} }),
|
||||||
];
|
];
|
||||||
let childPolicy: LoadBalancingConfig[];
|
let childPolicy: LoadBalancingConfig[];
|
||||||
if (this.lastestConfig.getLrsLoadReportingServerName()) {
|
if (this.lastestConfig.getLrsLoadReportingServerName() !== undefined) {
|
||||||
childPolicy = [new LrsLoadBalancingConfig(this.lastestConfig.getCluster(), this.lastestConfig.getEdsServiceName() ?? '', this.lastestConfig.getLrsLoadReportingServerName()!, localityObj.locality, endpointPickingPolicy)];
|
childPolicy = [new LrsLoadBalancingConfig(this.lastestConfig.getCluster(), this.lastestConfig.getEdsServiceName() ?? '', this.lastestConfig.getLrsLoadReportingServerName()!, localityObj.locality, endpointPickingPolicy)];
|
||||||
} else {
|
} else {
|
||||||
childPolicy = endpointPickingPolicy;
|
childPolicy = endpointPickingPolicy;
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { connectivityState as ConnectivityState, StatusObject, status as Status, experimental } from '@grpc/grpc-js';
|
import { connectivityState as ConnectivityState, StatusObject, status as Status, experimental } from '@grpc/grpc-js';
|
||||||
import { type } from 'os';
|
|
||||||
import { Locality__Output } from './generated/envoy/api/v2/core/Locality';
|
import { Locality__Output } from './generated/envoy/api/v2/core/Locality';
|
||||||
import { XdsClusterLocalityStats, XdsClient } from './xds-client';
|
import { XdsClusterLocalityStats, XdsClient } from './xds-client';
|
||||||
import LoadBalancer = experimental.LoadBalancer;
|
import LoadBalancer = experimental.LoadBalancer;
|
||||||
|
|
|
@ -1068,7 +1068,6 @@ export class XdsClient {
|
||||||
if (!this.lrsCall) {
|
if (!this.lrsCall) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace('Sending LRS stats');
|
|
||||||
const clusterStats: ClusterStats[] = [];
|
const clusterStats: ClusterStats[] = [];
|
||||||
for (const [
|
for (const [
|
||||||
{ clusterName, edsServiceName },
|
{ clusterName, edsServiceName },
|
||||||
|
@ -1129,6 +1128,7 @@ export class XdsClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
trace('Sending LRS stats ' + JSON.stringify(clusterStats, undefined, 2));
|
||||||
this.lrsCall.write({
|
this.lrsCall.write({
|
||||||
node: this.lrsNode!,
|
node: this.lrsNode!,
|
||||||
cluster_stats: clusterStats,
|
cluster_stats: clusterStats,
|
||||||
|
@ -1174,6 +1174,7 @@ export class XdsClient {
|
||||||
clusterName: string,
|
clusterName: string,
|
||||||
edsServiceName: string
|
edsServiceName: string
|
||||||
): XdsClusterDropStats {
|
): XdsClusterDropStats {
|
||||||
|
trace('addClusterDropStats(lrsServer=' + lrsServer + ', clusterName=' + clusterName + ', edsServiceName=' + edsServiceName + ')');
|
||||||
if (lrsServer !== '') {
|
if (lrsServer !== '') {
|
||||||
return {
|
return {
|
||||||
addCallDropped: (category) => {},
|
addCallDropped: (category) => {},
|
||||||
|
@ -1197,6 +1198,7 @@ export class XdsClient {
|
||||||
edsServiceName: string,
|
edsServiceName: string,
|
||||||
locality: Locality__Output
|
locality: Locality__Output
|
||||||
): XdsClusterLocalityStats {
|
): XdsClusterLocalityStats {
|
||||||
|
trace('addClusterLocalityStats(lrsServer=' + lrsServer + ', clusterName=' + clusterName + ', edsServiceName=' + edsServiceName + ', locality=' + JSON.stringify(locality) + ')');
|
||||||
if (lrsServer !== '') {
|
if (lrsServer !== '') {
|
||||||
return {
|
return {
|
||||||
addCallStarted: () => {},
|
addCallStarted: () => {},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/grpc-js",
|
"name": "@grpc/grpc-js",
|
||||||
"version": "1.2.9",
|
"version": "1.2.10",
|
||||||
"description": "gRPC Library for Node - pure JS implementation",
|
"description": "gRPC Library for Node - pure JS implementation",
|
||||||
"homepage": "https://grpc.io/",
|
"homepage": "https://grpc.io/",
|
||||||
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",
|
||||||
|
|
|
@ -442,21 +442,8 @@ export class Http2CallStream implements Call {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const status: StatusObject = { code, details, metadata };
|
const status: StatusObject = { code, details, metadata };
|
||||||
let finalStatus;
|
|
||||||
try {
|
|
||||||
// Attempt to assign final status.
|
|
||||||
finalStatus = this.filterStack.receiveTrailers(status);
|
|
||||||
} catch (error) {
|
|
||||||
// This is a no-op if the call was already ended when handling headers.
|
|
||||||
this.endCall({
|
|
||||||
code: Status.INTERNAL,
|
|
||||||
details: 'Failed to process received status',
|
|
||||||
metadata: new Metadata(),
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// This is a no-op if the call was already ended when handling headers.
|
// This is a no-op if the call was already ended when handling headers.
|
||||||
this.endCall(finalStatus);
|
this.endCall(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
attachHttp2Stream(
|
attachHttp2Stream(
|
||||||
|
|
Loading…
Reference in New Issue