Skip to content

Commit 18a8d3d

Browse files
extproc: implement ClientFilter and ClientFilterBuilder interface (#9086)
This PR is part of implementing [A93: xds-ext-proc](https://github.com/grpc/proposal/blob/master/A93-xds-ext-proc.md) This PR adds the builder that implements the [ClientFilter](https://github.com/grpc/grpc-go/blob/ac4aa01bd485f3a574469d7985cf55e79abf44a9/internal/xds/httpfilter/httpfilter.go#L80) and [ClientFilterBuilder](https://github.com/grpc/grpc-go/blob/ac4aa01bd485f3a574469d7985cf55e79abf44a9/internal/xds/httpfilter/httpfilter.go#L71) interface. That includes creating the interceptor config from the base and the override config. It also includes making the ext_proc channel. THis PR has a placeholder function for converting grpcService to channel The function will be implemented later when implementing [gRFC A102](https://github.com/grpc/proposal/A102-xds-grpc-service.md). The `interceptor` struct has a `resolver.ClientInterceptor` embedded for now, but that will be removed in a later PR when we implement the `resolver.ClientInterceptor` interface. Since the filter will not be registered and no one is calling the `resolver.ClientInterceptor` function fro extproc filter , it will not panic. #ext-proc-a93 RELEASE NOTES: None
1 parent db35da8 commit 18a8d3d

3 files changed

Lines changed: 412 additions & 14 deletions

File tree

internal/xds/httpfilter/extproc/config.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,28 @@ func processingModesFromProto(pm *v3procfilterpb.ProcessingMode) processingModes
156156
responseTrailerMode: resolveHeaderMode(pm.GetResponseTrailerMode(), modeSkip),
157157
}
158158
}
159+
160+
// newInterceptorConfig creates the interceptor config from the base and
161+
// override filter configs. If a field is set in both the base and override
162+
// configs, the value from the override config will be used.
163+
func newInterceptorConfig(base baseConfig, override overrideConfig) baseConfig {
164+
ic := base
165+
166+
// Apply overrides if present.
167+
if val, ok := override.server.Value(); ok {
168+
ic.server = val
169+
}
170+
if val, ok := override.failureModeAllow.Value(); ok {
171+
ic.failureModeAllow = val
172+
}
173+
if override.requestAttributes != nil {
174+
ic.requestAttributes = override.requestAttributes
175+
}
176+
if override.responseAttributes != nil {
177+
ic.responseAttributes = override.responseAttributes
178+
}
179+
if val, ok := override.processingModes.Value(); ok {
180+
ic.processingModes = val
181+
}
182+
return ic
183+
}

0 commit comments

Comments
 (0)