mirror of https://github.com/grpc/grpc-node.git
Fix Listener resource validation
This commit is contained in:
parent
e883425ef3
commit
87f703403c
|
@ -360,6 +360,10 @@ export class XdsDependencyManager {
|
|||
constructor(private xdsClient: XdsClient, private listenerResourceName: string, private dataPlaneAuthority: string, private watcher: XdsConfigWatcher) {
|
||||
this.ldsWatcher = new Watcher<Listener__Output>({
|
||||
onResourceChanged: (update: Listener__Output) => {
|
||||
if (!update.api_listener) {
|
||||
this.trace('Received Listener resource not usable on client');
|
||||
return;
|
||||
}
|
||||
this.latestListener = update;
|
||||
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL, update.api_listener!.api_listener!.value);
|
||||
switch (httpConnectionManager.route_specifier) {
|
||||
|
|
|
@ -294,6 +294,9 @@ export class ListenerResourceType extends XdsResourceType {
|
|||
if (message.default_filter_chain) {
|
||||
errors.push(...validateFilterChain(context, message.default_filter_chain).map(error => `default_filter_chain: ${error}`));
|
||||
}
|
||||
if (!message.api_listener && !message.default_filter_chain && message.filter_chains.length === 0) {
|
||||
errors.push('No api_listener and no filter_chains and no default_filter_chain');
|
||||
}
|
||||
if (errors.length === 0) {
|
||||
return {
|
||||
valid: true,
|
||||
|
|
Loading…
Reference in New Issue