• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #20276

11 May 2026 08:24AM UTC coverage: 88.821% (-0.02%) from 88.838%
#20276

push

github

web-flow
Allow injecting bootstrap info into xDS Filter API for config parsing (#12724)

Extend the xDS Filter API to support injecting bootstrap information
into filters during configuration parsing. This allows filters to access
context information (e.g., allowed gRPC services) from the resource loading
layer during configuration validation and parsing.

- Update `Filter.Provider.parseFilterConfig` and
`parseFilterConfigOverride`
  to accept a `FilterContext` parameter.
- Introduce `BootstrapInfoGrpcServiceContextProvider` to encapsulate
  bootstrap info for context resolution.
- Update `XdsListenerResource` and `XdsRouteConfigureResource` to
  construct and pass `FilterContext` during configuration parsing.
- Update sub-filters (`FaultFilter`, `RbacFilter`,
`GcpAuthenticationFilter`,
  `RouterFilter`) to match the updated `FilterContext` signature.

Known Gaps & Limitations:
1. **MetricHolder**: Propagation of `MetricHolder` is not supported with
   this approach currently and is planned for support in a later phase.
2. **NameResolverRegistry**: Propagation is deferred for consistency.
While it could be passed from `XdsNameResolver` on the client side, there is
no equivalent mechanism on the server side. To ensure consistent
behavior, `DefaultRegistry` is used when validating schemes and creating channels.

36254 of 40817 relevant lines covered (88.82%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/../xds/src/main/java/io/grpc/xds/RouterFilter.java
1
/*
2
 * Copyright 2021 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.xds;
18

19
import com.google.protobuf.Message;
20

21
/**
22
 * Router filter implementation. Currently this filter does not parse any field in the config.
23
 */
24
final class RouterFilter implements Filter {
25
  private static final RouterFilter INSTANCE = new RouterFilter();
1✔
26

27
  static final String TYPE_URL =
28
      "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router";
29

30
  static final FilterConfig ROUTER_CONFIG = new FilterConfig() {
1✔
31
    @Override
32
    public String typeUrl() {
33
      return TYPE_URL;
1✔
34
    }
35

36
    @Override
37
    public String toString() {
38
      return "ROUTER_CONFIG";
1✔
39
    }
40
  };
41

42
  static final class Provider implements Filter.Provider {
1✔
43
    @Override
44
    public String[] typeUrls() {
45
      return new String[]{TYPE_URL};
1✔
46
    }
47

48
    @Override
49
    public boolean isClientFilter() {
50
      return true;
1✔
51
    }
52

53
    @Override
54
    public boolean isServerFilter() {
55
      return true;
1✔
56
    }
57

58
    @Override
59
    public RouterFilter newInstance(String name) {
60
      return INSTANCE;
1✔
61
    }
62

63
    @Override
64
    public ConfigOrError<? extends FilterConfig> parseFilterConfig(
65
        Message rawProtoMessage, FilterConfigParseContext context) {
66
      return ConfigOrError.fromConfig(ROUTER_CONFIG);
1✔
67
    }
68

69
    @Override
70
    public ConfigOrError<? extends FilterConfig> parseFilterConfigOverride(
71
        Message rawProtoMessage, FilterConfigParseContext context) {
72
      return ConfigOrError.fromError("Router Filter should not have override config");
×
73
    }
74
  }
75

76
  private RouterFilter() {}
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc