@@ -40,7 +40,7 @@ import { XdsClusterManagerLoadBalancingConfig } from './load-balancer-xds-cluste
40
40
import { ExactValueMatcher , FullMatcher , HeaderMatcher , Matcher , PathExactValueMatcher , PathPrefixValueMatcher , PathSafeRegexValueMatcher , PrefixValueMatcher , PresentValueMatcher , RangeValueMatcher , RejectValueMatcher , SafeRegexValueMatcher , SuffixValueMatcher , ValueMatcher } from './matcher' ;
41
41
import { envoyFractionToFraction , Fraction } from "./fraction" ;
42
42
import { RouteAction , SingleClusterRouteAction , WeightedCluster , WeightedClusterRouteAction } from './route-action' ;
43
- import { decodeSingleResource , HTTP_CONNECTION_MANGER_TYPE_URL_V3 } from './resources' ;
43
+ import { decodeSingleResource , HTTP_CONNECTION_MANGER_TYPE_URL } from './resources' ;
44
44
import Duration = experimental . Duration ;
45
45
import { Duration__Output } from './generated/google/protobuf/Duration' ;
46
46
import { createHttpFilter , HttpFilterConfig , parseOverrideFilterConfig , parseTopLevelFilterConfig } from './http-filter' ;
@@ -212,7 +212,6 @@ class XdsResolver implements Resolver {
212
212
private latestRouteConfigName : string | null = null ;
213
213
214
214
private latestRouteConfig : RouteConfiguration__Output | null = null ;
215
- private latestRouteConfigIsV2 = false ;
216
215
217
216
private clusterRefcounts = new Map < string , { inLastConfig : boolean , refCount : number } > ( ) ;
218
217
@@ -226,15 +225,15 @@ class XdsResolver implements Resolver {
226
225
private channelOptions : ChannelOptions
227
226
) {
228
227
this . ldsWatcher = {
229
- onValidUpdate : ( update : Listener__Output , isV2 : boolean ) => {
230
- const httpConnectionManager = decodeSingleResource ( HTTP_CONNECTION_MANGER_TYPE_URL_V3 , update . api_listener ! . api_listener ! . value ) ;
228
+ onValidUpdate : ( update : Listener__Output ) => {
229
+ const httpConnectionManager = decodeSingleResource ( HTTP_CONNECTION_MANGER_TYPE_URL , update . api_listener ! . api_listener ! . value ) ;
231
230
const defaultTimeout = httpConnectionManager . common_http_protocol_options ?. idle_timeout ;
232
231
if ( defaultTimeout === null || defaultTimeout === undefined ) {
233
232
this . latestDefaultTimeout = undefined ;
234
233
} else {
235
234
this . latestDefaultTimeout = protoDurationToDuration ( defaultTimeout ) ;
236
235
}
237
- if ( ! isV2 && EXPERIMENTAL_FAULT_INJECTION ) {
236
+ if ( EXPERIMENTAL_FAULT_INJECTION ) {
238
237
this . ldsHttpFilterConfigs = [ ] ;
239
238
for ( const filter of httpConnectionManager . http_filters ) {
240
239
// typed_config must be set here, or validation would have failed
@@ -260,7 +259,7 @@ class XdsResolver implements Resolver {
260
259
if ( this . latestRouteConfigName ) {
261
260
getSingletonXdsClient ( ) . removeRouteWatcher ( this . latestRouteConfigName , this . rdsWatcher ) ;
262
261
}
263
- this . handleRouteConfig ( httpConnectionManager . route_config ! , isV2 ) ;
262
+ this . handleRouteConfig ( httpConnectionManager . route_config ! ) ;
264
263
break ;
265
264
default :
266
265
// This is prevented by the validation rules
@@ -280,8 +279,8 @@ class XdsResolver implements Resolver {
280
279
}
281
280
} ;
282
281
this . rdsWatcher = {
283
- onValidUpdate : ( update : RouteConfiguration__Output , isV2 : boolean ) => {
284
- this . handleRouteConfig ( update , isV2 ) ;
282
+ onValidUpdate : ( update : RouteConfiguration__Output ) => {
283
+ this . handleRouteConfig ( update ) ;
285
284
} ,
286
285
onTransientError : ( error : StatusObject ) => {
287
286
/* A transient error only needs to bubble up as a failure if we have
@@ -311,14 +310,13 @@ class XdsResolver implements Resolver {
311
310
refCount . refCount -= 1 ;
312
311
if ( ! refCount . inLastConfig && refCount . refCount === 0 ) {
313
312
this . clusterRefcounts . delete ( clusterName ) ;
314
- this . handleRouteConfig ( this . latestRouteConfig ! , this . latestRouteConfigIsV2 ) ;
313
+ this . handleRouteConfig ( this . latestRouteConfig ! ) ;
315
314
}
316
315
}
317
316
}
318
317
319
- private handleRouteConfig ( routeConfig : RouteConfiguration__Output , isV2 : boolean ) {
318
+ private handleRouteConfig ( routeConfig : RouteConfiguration__Output ) {
320
319
this . latestRouteConfig = routeConfig ;
321
- this . latestRouteConfigIsV2 = isV2 ;
322
320
/* Select the virtual host using the default authority override if it
323
321
* exists, and the channel target otherwise. */
324
322
const hostDomain = this . channelOptions [ 'grpc.default_authority' ] ?? this . target . path ;
@@ -328,7 +326,7 @@ class XdsResolver implements Resolver {
328
326
return ;
329
327
}
330
328
const virtualHostHttpFilterOverrides = new Map < string , HttpFilterConfig > ( ) ;
331
- if ( ! isV2 && EXPERIMENTAL_FAULT_INJECTION ) {
329
+ if ( EXPERIMENTAL_FAULT_INJECTION ) {
332
330
for ( const [ name , filter ] of Object . entries ( virtualHost . typed_per_filter_config ?? { } ) ) {
333
331
const parsedConfig = parseOverrideFilterConfig ( filter ) ;
334
332
if ( parsedConfig ) {
@@ -357,7 +355,7 @@ class XdsResolver implements Resolver {
357
355
timeout = undefined ;
358
356
}
359
357
const routeHttpFilterOverrides = new Map < string , HttpFilterConfig > ( ) ;
360
- if ( ! isV2 && EXPERIMENTAL_FAULT_INJECTION ) {
358
+ if ( EXPERIMENTAL_FAULT_INJECTION ) {
361
359
for ( const [ name , filter ] of Object . entries ( route . typed_per_filter_config ?? { } ) ) {
362
360
const parsedConfig = parseOverrideFilterConfig ( filter ) ;
363
361
if ( parsedConfig ) {
@@ -372,7 +370,7 @@ class XdsResolver implements Resolver {
372
370
const cluster = route . route ! . cluster ! ;
373
371
allConfigClusters . add ( cluster ) ;
374
372
const extraFilterFactories : FilterFactory < Filter > [ ] = [ ] ;
375
- if ( ! isV2 && EXPERIMENTAL_FAULT_INJECTION ) {
373
+ if ( EXPERIMENTAL_FAULT_INJECTION ) {
376
374
for ( const filterConfig of this . ldsHttpFilterConfigs ) {
377
375
if ( routeHttpFilterOverrides . has ( filterConfig . name ) ) {
378
376
const filter = createHttpFilter ( filterConfig . config , routeHttpFilterOverrides . get ( filterConfig . name ) ! ) ;
@@ -401,7 +399,7 @@ class XdsResolver implements Resolver {
401
399
allConfigClusters . add ( clusterWeight . name ) ;
402
400
const extraFilterFactories : FilterFactory < Filter > [ ] = [ ] ;
403
401
const clusterHttpFilterOverrides = new Map < string , HttpFilterConfig > ( ) ;
404
- if ( ! isV2 && EXPERIMENTAL_FAULT_INJECTION ) {
402
+ if ( EXPERIMENTAL_FAULT_INJECTION ) {
405
403
for ( const [ name , filter ] of Object . entries ( clusterWeight . typed_per_filter_config ?? { } ) ) {
406
404
const parsedConfig = parseOverrideFilterConfig ( filter ) ;
407
405
if ( parsedConfig ) {
0 commit comments