Skip to content

Commit 596d5f1

Browse files
committed
Merge branch 'master' into grpc-js-xds_federation
2 parents 9d1b849 + 2a11a2c commit 596d5f1

File tree

7 files changed

+70
-22
lines changed

7 files changed

+70
-22
lines changed

packages/grpc-js-xds/scripts/xds.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ GRPC_NODE_TRACE=xds_client,xds_resolver,xds_cluster_manager,cds_balancer,xds_clu
6060
--path_to_server_binary=/java_server/grpc-java/interop-testing/build/install/grpc-interop-testing/bin/xds-test-server \
6161
--gcp_suffix=$(date '+%s') \
6262
--verbose \
63-
--qps=50 \
63+
--qps=75 \
6464
${XDS_V3_OPT-} \
6565
--client_cmd="$(which node) --enable-source-maps --prof --logfile=${KOKORO_ARTIFACTS_DIR}/github/grpc/reports/prof.log grpc-node/packages/grpc-js-xds/build/interop/xds-interop-client \
6666
--server=xds:///{server_uri} \

packages/grpc-js-xds/scripts/xds_k8s_lb.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ main() {
170170
run_test $test || (( ++failed_tests ))
171171
done
172172
echo "Failed test suites: ${failed_tests}"
173-
if (( failed_tests > 0 )); then
174-
exit 1
175-
fi
176173
}
177174

178175
main "$@"

packages/grpc-js-xds/src/matcher.ts

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,19 @@ export interface ValueMatcher {
3737
}
3838

3939
export class ExactValueMatcher implements ValueMatcher {
40-
constructor(private targetValue: string) {}
40+
constructor(private targetValue: string, private ignoreCase: boolean) {
41+
}
4142

4243
apply(value: string) {
43-
return value === this.targetValue;
44+
if (this.ignoreCase) {
45+
return value.toLowerCase() === this.targetValue.toLowerCase();
46+
} else {
47+
return value === this.targetValue;
48+
}
4449
}
4550

4651
toString() {
47-
return 'Exact(' + this.targetValue + ')';
52+
return 'Exact(' + this.targetValue + ', ignore_case=' + this.ignoreCase + ')';
4853
}
4954
}
5055

@@ -94,26 +99,51 @@ export class PresentValueMatcher implements ValueMatcher {
9499
}
95100

96101
export class PrefixValueMatcher implements ValueMatcher {
97-
constructor(private prefix: string) {}
102+
constructor(private prefix: string, private ignoreCase: boolean) {
103+
}
98104

99105
apply(value: string) {
100-
return value.startsWith(this.prefix);
106+
if (this.ignoreCase) {
107+
return value.toLowerCase().startsWith(this.prefix.toLowerCase());
108+
} else {
109+
return value.startsWith(this.prefix);
110+
}
101111
}
102112

103113
toString() {
104-
return 'Prefix(' + this.prefix + ')';
114+
return 'Prefix(' + this.prefix + ', ignore_case=' + this.ignoreCase + ')';
105115
}
106116
}
107117

108118
export class SuffixValueMatcher implements ValueMatcher {
109-
constructor(private suffix: string) {}
119+
constructor(private suffix: string, private ignoreCase: boolean) {}
110120

111121
apply(value: string) {
112-
return value.endsWith(this.suffix);
122+
if (this.ignoreCase) {
123+
return value.toLowerCase().endsWith(this.suffix.toLowerCase());
124+
} else {
125+
return value.endsWith(this.suffix);
126+
}
127+
}
128+
129+
toString() {
130+
return 'Suffix(' + this.suffix + ', ignore_case=' + this.ignoreCase + ')';
131+
}
132+
}
133+
134+
export class ContainsValueMatcher implements ValueMatcher {
135+
constructor(private contains: string, private ignoreCase: boolean) {}
136+
137+
apply(value: string) {
138+
if (this.ignoreCase) {
139+
return value.toLowerCase().includes(this.contains.toLowerCase());
140+
} else {
141+
return value.includes(this.contains);
142+
}
113143
}
114144

115145
toString() {
116-
return 'Suffix(' + this.suffix + ')';
146+
return 'Contains(' + this.contains + + ', ignore_case=' + this.ignoreCase + ')';
117147
}
118148
}
119149

packages/grpc-js-xds/src/resolver-xds.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { HeaderMatcher__Output } from './generated/envoy/config/route/v3/HeaderM
3737
import ConfigSelector = experimental.ConfigSelector;
3838
import LoadBalancingConfig = experimental.LoadBalancingConfig;
3939
import { XdsClusterManagerLoadBalancingConfig } from './load-balancer-xds-cluster-manager';
40-
import { ExactValueMatcher, FullMatcher, HeaderMatcher, Matcher, PathExactValueMatcher, PathPrefixValueMatcher, PathSafeRegexValueMatcher, PrefixValueMatcher, PresentValueMatcher, RangeValueMatcher, RejectValueMatcher, SafeRegexValueMatcher, SuffixValueMatcher, ValueMatcher } from './matcher';
40+
import { ContainsValueMatcher, ExactValueMatcher, FullMatcher, HeaderMatcher, Matcher, PathExactValueMatcher, PathPrefixValueMatcher, PathSafeRegexValueMatcher, PrefixValueMatcher, PresentValueMatcher, RangeValueMatcher, RejectValueMatcher, SafeRegexValueMatcher, SuffixValueMatcher, ValueMatcher } from './matcher';
4141
import { envoyFractionToFraction, Fraction } from "./fraction";
4242
import { RouteAction, SingleClusterRouteAction, WeightedCluster, WeightedClusterRouteAction } from './route-action';
4343
import { decodeSingleResource, HTTP_CONNECTION_MANGER_TYPE_URL } from './resources';
@@ -136,7 +136,7 @@ function getPredicateForHeaderMatcher(headerMatch: HeaderMatcher__Output): Match
136136
let valueChecker: ValueMatcher;
137137
switch (headerMatch.header_match_specifier) {
138138
case 'exact_match':
139-
valueChecker = new ExactValueMatcher(headerMatch.exact_match!);
139+
valueChecker = new ExactValueMatcher(headerMatch.exact_match!, false);
140140
break;
141141
case 'safe_regex_match':
142142
valueChecker = new SafeRegexValueMatcher(headerMatch.safe_regex_match!.regex);
@@ -150,10 +150,30 @@ function getPredicateForHeaderMatcher(headerMatch: HeaderMatcher__Output): Match
150150
valueChecker = new PresentValueMatcher();
151151
break;
152152
case 'prefix_match':
153-
valueChecker = new PrefixValueMatcher(headerMatch.prefix_match!);
153+
valueChecker = new PrefixValueMatcher(headerMatch.prefix_match!, false);
154154
break;
155155
case 'suffix_match':
156-
valueChecker = new SuffixValueMatcher(headerMatch.suffix_match!);
156+
valueChecker = new SuffixValueMatcher(headerMatch.suffix_match!, false);
157+
break;
158+
case 'string_match':
159+
const stringMatch = headerMatch.string_match!
160+
switch (stringMatch.match_pattern) {
161+
case 'exact':
162+
valueChecker = new ExactValueMatcher(stringMatch.exact!, stringMatch.ignore_case);
163+
break;
164+
case 'safe_regex':
165+
valueChecker = new SafeRegexValueMatcher(stringMatch.safe_regex!.regex);
166+
break;
167+
case 'prefix':
168+
valueChecker = new PrefixValueMatcher(stringMatch.prefix!, stringMatch.ignore_case);
169+
break;
170+
case 'suffix':
171+
valueChecker = new SuffixValueMatcher(stringMatch.suffix!, stringMatch.ignore_case);
172+
break;
173+
case 'contains':
174+
valueChecker = new ContainsValueMatcher(stringMatch.contains!, stringMatch.ignore_case);
175+
break;
176+
}
157177
break;
158178
default:
159179
valueChecker = new RejectValueMatcher();

packages/grpc-js-xds/src/xds-stream-state/rds-state.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const SUPPPORTED_HEADER_MATCH_SPECIFIERS = [
2929
'range_match',
3030
'present_match',
3131
'prefix_match',
32-
'suffix_match'];
32+
'suffix_match',
33+
'string_match'];
3334
const SUPPORTED_CLUSTER_SPECIFIERS = ['cluster', 'weighted_clusters', 'cluster_header'];
3435

3536
const UINT32_MAX = 0xFFFFFFFF;

packages/proto-loader/bin/proto-loader-gen-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ async function runScript() {
835835
boolean: true,
836836
default: false,
837837
};
838-
const argv = yargs
838+
const argv = await yargs
839839
.parserConfiguration({
840840
'parse-positional-numbers': false
841841
})

packages/proto-loader/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/proto-loader",
3-
"version": "0.7.6",
3+
"version": "0.7.7",
44
"author": "Google Inc.",
55
"contributors": [
66
{
@@ -49,14 +49,14 @@
4949
"lodash.camelcase": "^4.3.0",
5050
"long": "^4.0.0",
5151
"protobufjs": "^7.0.0",
52-
"yargs": "^16.2.0"
52+
"yargs": "^17.7.2"
5353
},
5454
"devDependencies": {
5555
"@types/lodash.camelcase": "^4.3.4",
5656
"@types/mkdirp": "^1.0.1",
5757
"@types/mocha": "^5.2.7",
5858
"@types/node": "^10.17.26",
59-
"@types/yargs": "^16.0.4",
59+
"@types/yargs": "^17.0.24",
6060
"clang-format": "^1.2.2",
6161
"gts": "^3.1.0",
6262
"rimraf": "^3.0.2",

0 commit comments

Comments
 (0)